Content management client synchronization service

ABSTRACT

The disclosed technology relates to a system configured to compute a difference between a remote tree data structure representing a server state for content items associated with an account on a content management system and a sync tree data structure representing a known synchronization state between the content management system and the computing system. The system is configured to generate, based on the difference, a set of operations that when performed on the computing system update the content items stored on the client device to converge a file system state on the computing system and the server state.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of U.S. provisional application No.62/611,473, filed on Dec. 28, 2017, which is expressly incorporated byreference herein in its entirety.

BACKGROUND

Content management systems allow users to access and manage contentitems across multiple devices using a network. Some content managementsystems may allow users to share content items and provide additionalfeatures that aid users in collaborating using the content items.Content management systems generally store content items on servers andallow users access to the content items over a network. Some contentmanagement systems also allow for local copies to be stored on a clientdevice in order to provide users with faster access to content items ina more natural interface (e.g., a native application or within the filesystem of the client device). Additionally, this allows the user to haveaccess to the content items when the user is offline. Content managementsystems attempt to synchronize copies of a content item across a numberof client devices and the servers so that each copy is identical.However, synchronization of content items is difficult and is associatedwith numerous technical obstacles.

BRIEF DESCRIPTION OF THE DRAWINGS

The above-recited and other advantages and features of the presenttechnology will become apparent by reference to specific implementationsillustrated in the appended drawings. A person of ordinary skill in theart will understand that these drawings only show some examples of thepresent technology and would not limit the scope of the presenttechnology to these examples. Furthermore, the skilled artisan willappreciate the principles of the present technology as described andexplained with additional specificity and detail through the use of theaccompanying drawings in which:

FIG. 1 shows an example of a content management system and clientdevices, in accordance with some embodiments;

FIG. 2 shows an example of a client synchronization service, inaccordance with some embodiments;

FIG. 3 shows an example of tree data structures, in accordance withvarious embodiments;

FIG. 4 shows an example of tree data structures, in accordance withvarious embodiments;

FIG. 5 shows an example method for synchronizing a server state and afile system state using tree data structures, in accordance with variousembodiments of the subject technology;

FIG. 6 shows an example method for resolving conflicts whensynchronizing a server state and a file system state using tree datastructures, in accordance with various embodiments of the subjecttechnology;

FIG. 7 shows an example of tree data structures illustrating a violationof a rule for an add operation, in accordance with various embodiments;

FIG. 8 shows an example method for incrementally converging a serverstate and a file system state, in accordance with various embodiments ofthe subject technology;

FIG. 9 shows an example of tree data structures, in accordance withvarious embodiments;

FIG. 10 shows an example scenario;

FIG. 11 shows an example Venn diagram representation of two plans ofoperations, in accordance with various embodiments of the subjecttechnology;

FIG. 12 shows an example method for managing changes in plans ofoperations, in accordance with various embodiments of the subjecttechnology;

FIG. 13 shows an illustration of a filename array and a hash indexarray, in accordance with various embodiments of the subject technology;

FIG. 14 shows an example method for storing a filename, in accordancewith various embodiments of the subject technology;

FIG. 15 shows an example method for retrieving a location of a filenamegiven the filename, in accordance with various embodiments of thesubject technology;

FIGS. 16A and 16B show examples of tree data structures, in accordancewith various embodiments;

FIG. 17 shows an example of tree data structures, in accordance withvarious embodiments;

FIG. 18 shows an example method for retrieving a location of a filenamegiven the filename, in accordance with various embodiments of thesubject technology; and

FIG. 19 shows an example of a system for implementing certain aspects ofthe present technology.

DETAILED DESCRIPTION

Various examples of the present technology are discussed in detailbelow. While specific implementations are discussed, it should beunderstood that this is done for illustration purposes only. A personskilled in the relevant art will recognize that other components andconfigurations may be used without parting from the spirit and scope ofthe present technology.

Various advances in computing and networking technologies have enabledcontent management systems to provide users with access to content itemsacross multiple devices. The content items may include, but are notlimited to, files, documents, messages (e.g., email messages or textmessages), media files (e.g., photos, videos, and audio files), folderscontaining other content items, or any other unit of content. Contentitems may be shared with multiple users, edited, deleted, added,renamed, or moved. However, synchronizing these content items acrossseveral computing devices (e.g., servers and client devices) and acrossseveral user accounts has remained flawed and rife with technologicalobstacles.

To illustrate some of the technical obstacles, a first machine (e.g., aclient device or server) may send communications to a second machinethat provides information about how a user has modified content itemsmanaged by the content management system. These communications may beused by the second machine to synchronize the content items on thesecond machine such that actions performed on content items on the firstmachine are reflected in content items on the second machine and thecontent items on the first machine are substantially identical to thecontent items on the second machine.

However, there may be several communications sent and the communicationsmay be received out of order as a result of various network routingprotocols used by the one or more networks used to transmit thecommunications, the technical operations of the first or second machine,or some other reason. Furthermore, a user may be performing a largenumber of modifications to a large number of content items, undoprevious modifications in a short amount of time, or quickly performadditional modifications to a previously modified content item or set ofcontent items. This increases the likelihood that these communicationsare received out of order, certain communications are out of date, orthat the second machine will perform operations on content items thatare not up to date. As a result, many of the operations may not becompatible with the current state of the content items. In fact, it maybe difficult to even detect whether some operations are in conflict withother operations or with the current state of the content items.

Additionally, there is an inherent latency with respect tosynchronization actions. For example, actions taken on the first machineare first detected by the first machine, and a communication isgenerated and then transmitted through a network. The communication isreceived by the second machine, which may still be processing previouscommunications and taking actions detailed in the communications. Inthis illustrative scenario, there are several points where latency isintroduced by limited computing resources (e.g., bandwidth, memory,processing time, processing cycles, etc.) of the first machine, thesecond machine, and/or the network. As latency increases the likelihoodthat communications, for some reason, conflict with the current state ofthe content items are increased. Furthermore, processing theseconflicted communications and resolving the conflicts also expendsneedless computing resources such as processing time, memory, energy, orbandwidth and further increases latency.

To further complicate matters, the same or different user on the secondmachine and/or additional machines with access to the content items mayalso be performing modification to the content items. As a result, theissues above may be multiplied and additional technical issues arise asto whether local actions conflict with remote actions and/or whetherlocal actions are operating on up to date content items.

The disclosed technology addresses the need in the art for a clientsynchronization service for a content management system that provides atechnical solution to the technical problems above as well as others.The client synchronization service may be configured to operate on aclient device and identify synchronization mismatches between contentitems on a server of the content management system and correspondingcontent items on the client device. For each synchronization mismatch,the client synchronization service may identify operations needed tosynchronize the content items and initiate those operations.

The client synchronization service may track the status of content itemson the server, the status of content items on the client device, andtheir synchronization state using a set of tree data structures(“trees”). According to some embodiments, a set of 3 trees may be used.The three trees may include a remote tree that represents a serverstate, a local tree that represents the file system state on the clientdevice, and a sync tree that represents a merge base for the local treeand the remote tree. The merge base may be thought of as a commonancestor of the local tree and the remote tree or a last known syncedstate between the local tree and the remote tree. Accordingly, theclient synchronization service may determine that the server state andthe client device state are synchronized when all 3 trees (e.g., theremote tree, the sync tree, and the local tree) are identical.

When a modification to the server state of the content items or theclient device file system state (“file system state”) of the contentitems is detected, the client synchronization service updates theappropriate tree and determines whether the server state and the filesystem state are synchronized based on the triumvirate of trees. Basedon the update to one of the trees, the server state and the file systemstate may become synchronized, become unsynchronized, or become furtherunsynchronized. If the server state and the file system state are notsynchronized, the client synchronization service may identify at leastan initial set of operations needed to converge the server state and thefile system state and get the server state and the file system statecloser to a synchronized state.

By relying on the set of tree data structures to monitor the serverstate and the file system state provides alternatives and/or solutionsrooted in computing technology to various technical problems. Forexample, the client synchronization service is able to track the serverstate as well as the file state and store a representation of a mergebase of the two states. As a result, the various embodiments of thesubject technology avoid the technical problems associated withreceiving a number of communications specifying how users are modifyingcontent items remotely and determining which order these modificationsshould be implemented locally, whether the modifications conflict withother modifications or are out of date, and whether remote modificationsconflict with local modifications performed locally by users. Many ofthese issues arise from other solutions not being able to track thestate of the various actors involved (e.g., the server and the clientdevice) and not being able to quickly determine whether the states arein sync. Instead, these other solutions rely on receiving instructionson how to modify content items locally, without the context of whetherthe server state and file system state are in sync.

Furthermore, since the server state and the file system state arecontinuously monitored, determining whether they are synced is much moreefficient in terms of procedural complexity as well as computing timeand resources. As is described in further detail below, the clientsynchronization service enables the incremental and methodicalsynchronization of the server state and the file system state in a moredeterministic manner. As a result, the scaling and testing of contentmanagement system features is also more efficient.

Content Management System

In some embodiments, the disclosed technology is deployed in the contextof a content management system having content item synchronizationcapabilities and collaboration features, among others. An example systemconfiguration 100 is shown in FIG. 1A, which depicts content managementsystem 110 interacting with client device 150.

Accounts

Content management system 110 can store content items in associationwith accounts, as well as perform a variety of content item managementtasks, such as retrieve, modify, browse, and/or share the contentitem(s). Furthermore, content management system 110 can enable anaccount to access content item(s) from multiple client devices.

Content management system 110 supports a plurality of accounts. Anentity (user, group of users, team, company, etc.) can create an accountwith content management system, and account details can be stored inaccount database 140. Account database 140 can store profile informationfor registered entities. In some cases, profile information forregistered entities includes a username and/or email address. Accountdatabase 140 can include account management information, such as accounttype (e.g. various tiers of free or paid accounts), storage spaceallocated, storage space used, client devices 150 having a registeredcontent management client application 152 resident thereon, securitysettings, personal configuration settings, etc.

Account database 140 can store groups of accounts associated with anentity. Groups can have permissions based on group policies and/oraccess control lists, and members of the groups can inherit thepermissions. For example, a marketing group can have access to one setof content items while an engineering group can have access to anotherset of content items. An administrator group can modify groups, modifyuser accounts, etc.

Content Item Storage

A feature of content management system 110 is the storage of contentitems, which can be stored in content storage 142. Content items can beany digital data such as documents, collaboration content items, textfiles, audio files, image files, video files, webpages, executablefiles, binary files, etc. A content item can also include collections orother mechanisms for grouping content items together with differentbehaviors, such as folders, zip files, playlists, albums, etc. Acollection can refer to a folder, or a plurality of content items thatare related or grouped by a common attribute. In some embodiments,content storage 142 is combined with other types of storage or databasesto handle specific functions. Content storage 142 can store contentitems, while metadata regarding the content items can be stored inmetadata database 146. Likewise, data regarding where a content item isstored in content storage 142 can be stored in content directory 144.Additionally, data regarding changes, access, etc. can be stored inserver file journal 148. Each of the various storages/databases such ascontent storage 142, content directory 144, server file journal 148, andmetadata database 146 can be comprised of more than one such storage ordatabase and can be distributed over many devices and locations. Otherconfigurations are also possible. For example, data from content storage142, content directory 144, server file journal 148, and/or metadatadatabase 146 may be combined into one or more content storages ordatabases or further segmented into additional content storages ordatabases. Thus, content management system 110 may include more or lessstorages and/or databases than shown in FIG. 1.

In some embodiments, content storage 142 is associated with at least onecontent storage service 116, which includes software or other processorexecutable instructions for managing the storage of content itemsincluding, but not limited to, receiving content items for storage,preparing content items for storage, selecting a storage location forthe content item, retrieving content items from storage, etc. In someembodiments, content storage service 116 can divide a content item intosmaller chunks for storage at content storage 142. The location of eachchunk making up a content item can be recorded in content directory 144.Content directory 144 can include a content entry for each content itemstored in content storage 142. The content entry can be associated witha unique ID, which identifies a content item.

In some embodiments, the unique ID, which identifies a content item incontent directory 144, can be derived from a deterministic hashfunction. This method of deriving a unique ID for a content item canensure that content item duplicates are recognized as such since thedeterministic hash function will output the same identifier for everycopy of the same content item, but will output a different identifierfor a different content item. Using this methodology, content storageservice 116 can output a unique ID for each content item.

Content storage service 116 can also designate or record a content pathfor a content item in metadata database 146. The content path caninclude the name of the content item and/or folder hierarchy associatedwith the content item. For example, the content path can include afolder or path of folders in which the content item is stored in a localfile system on a client device. While content items are stored incontent storage 142 in blocks and may not be stored under a tree likedirectory structure, such directory structure is a comfortablenavigation structure for users. Content storage service 116 can defineor record a content path for a content item wherein the “root” node of adirectory structure can be a namespace for each account. Within thenamespace can be a directory structure defined by a user of an accountand/or content storage service 116. Metadata database 146 can store thecontent path for each content item as part of a content entry.

In some embodiments the namespace can include additional namespacesnested in the directory structure as if they are stored within the rootnode. This can occur when an account has access to a shared collection.Shared collections can be assigned their own namespace within contentmanagement system 110. While some shared collections are actually a rootnode for the shared collection, they are located subordinate to theaccount namespace in the directory structure, and can appear as a folderwithin a folder for the account. As addressed above, the directorystructure is merely a comfortable navigation structure for users, butdoes not correlate to storage locations of content items in contentstorage 142.

While the directory structure in which an account views content itemsdoes not correlate to storage locations at content management system110, the directory structure can correlate to storage locations onclient device 150 depending on the file system used by client device150.

As addressed above, a content entry in content directory 144 can alsoinclude the location of each chunk making up a content item. Morespecifically, the content entry can include content pointers thatidentify the location in content storage 142 of the chunks that make upthe content item.

In addition to a content path and content pointer, a content entry incontent directory 144 can also include a user account identifier thatidentifies the user account that has access to the content item and/or agroup identifier that identifies a group with access to the content itemand/or a namespace to which the content entry belongs.

Content storage service 116 can decrease the amount of storage spacerequired by identifying duplicate content items or duplicate blocks thatmake up a content item or versions of a content item. Instead of storingmultiple copies, content storage 142 can store a single copy of thecontent item or block of the content item and content directory 144 caninclude a pointer or other mechanism to link the duplicates to thesingle copy.

Content storage service 116 can also store metadata describing contentitems, content item types, folders, file path, and/or the relationshipof content items to various accounts, collections, or groups in metadatadatabase 146, in association with the unique ID of the content item.

Content storage service 116 can also store a log of data regardingchanges, access, etc. in server file journal 148. Server file journal148 can include the unique ID of the content item and a description ofthe change or access action along with a time stamp or version numberand any other relevant data. Server file journal 148 can also includepointers to blocks affected by the change or content item access.Content storage service can provide the ability to undo operations, byusing a content item version control that tracks changes to contentitems, different versions of content items (including diverging versiontrees), and a change history that can be acquired from the server filejournal 148.

Content Item Synchronization

Another feature of content management system 110 is synchronization ofcontent items with at least one client device 150. Client device(s) cantake different forms and have different capabilities. For example,client device 150 ₁ is a computing device having a local file systemaccessible by multiple applications resident thereon. Client device 150₂ is a computing device wherein content items are only accessible to aspecific application or by permission given by the specific application,and the content items are typically stored either in an applicationspecific space or in the cloud. Client device 150 ₃ is any client deviceaccessing content management system 110 via a web browser and accessingcontent items via a web interface. While example client devices 150 ₁,150 ₂, and 150 ₃ are depicted in form factors such as a laptop, mobiledevice, or web browser, it should be understood that the descriptionsthereof are not limited to devices of these example form factors. Forexample a mobile device such as client 150 ₂ might have a local filesystem accessible by multiple applications resident thereon, or client150 ₂ might access content management system 110 via a web browser. Assuch, the form factor should not be considered limiting when consideringclient 150's capabilities. One or more functions described herein withrespect to client device 150 may or may not be available on every clientdevice depending on the specific capabilities of the device—the fileaccess model being one such capability.

In many embodiments, client devices are associated with an account ofcontent management system 110, but in some embodiments client devicescan access content using shared links and do not require an account.

As noted above, some client devices can access content management system110 using a web browser. However, client devices can also access contentmanagement system 110 using client application 152 stored and running onclient device 150. Client application 152 can include a clientsynchronization service 156.

Client synchronization service 156 can be in communication with serversynchronization service 112 to synchronize changes to content itemsbetween client device 150 and content management system 110.

Client device 150 can synchronize content with content management system110 via client synchronization service 156. The synchronization can beplatform agnostic. That is, content can be synchronized across multipleclient devices of varying type, capabilities, operating systems, etc.Client synchronization service 156 can synchronize any changes (new,deleted, modified, copied, or moved content items) to content items in adesignated location of a file system of client device 150.

Content items can be synchronized from client device 150 to contentmanagement system 110, and vice versa. In embodiments whereinsynchronization is from client device 150 to content management system110, a user can manipulate content items directly from the file systemof client device 150, while client synchronization service 156 canmonitor directory on client device 150 for changes to files within themonitored folders.

When client synchronization service 156 detects a write, move, copy, ordelete of content in a directory that it monitors, clientsynchronization service 156 can synchronize the changes to contentmanagement system service 116. In some embodiments, clientsynchronization service 156 can perform some functions of contentmanagement system service 116 including functions addressed above suchas dividing the content item into blocks, hashing the content item togenerate a unique identifier, etc. Client synchronization service 156can index content within client storage index 164 and save the result instorage index 164. Indexing can include storing paths plus a uniqueserver identifier, and a unique client identifier for each content item.In some embodiments, client synchronization service 156 learns theunique server identifier from server synchronization service 112, andlearns the unique client identifier from the operating system of clientdevice 150.

Client synchronization service 156 can use storage index 164 tofacilitate the synchronization of at least a portion of the contentwithin client storage with content associated with a user account oncontent management system 110. For example, client synchronizationservice 156 can compare storage index 164 with content management system110 and detect differences between content on client storage and contentassociated with a user account on content management system 110. Clientsynchronization service 156 can then attempt to reconcile differences byuploading, downloading, modifying, and deleting content on clientstorage as appropriate. Content storage service 116 can store thechanged or new block for the content item and update server file journal148, metadata database 146, content directory 144, content storage 142,account database 140, etc., as appropriate.

When synchronizing from content management system 110 to client device150, a mount, modification, addition, deletion, move of a content itemrecorded in server file journal 148 can trigger a notification to besent to client device 150 using notification service 117. When clientdevice 150 is informed of the change a request changes listed in serverfile journal 148 since the last synchronization point known to theclient device. When client device 150 determines that it is out ofsynchronization with content management system 110, clientsynchronization service 156 requests content item blocks including thechanges, and updates its local copy of the changed content items.

In some embodiments, storage index 164 stores tree data structureswherein one tree reflects the latest representation of a directoryaccording to server synchronization service 112, while another treereflects the latest representation of the directory according to clientsynchronization service 156. Client synchronization service can work toensure that the tree structures match by requesting data from serversynchronization service 112 or committing changes on client device 150to content management system 110.

Sometimes client device 150 might not have a network connectionavailable. In this scenario, client synchronization service 156 canmonitor the linked collection for content item changes and queue thosechanges for later synchronization to content management system 110 whena network connection is available. Similarly, a user can manually start,stop, pause, or resume synchronization with content management system110.

Client synchronization service 156 can synchronize all contentassociated with a particular user account on content management system110. Alternatively, client synchronization service 156 can selectivelysynchronize a portion of the content of the total content associatedwith the particular user account on content management system 110.Selectively synchronizing only a portion of the content can preservespace on client device 150 and save bandwidth.

In some embodiments, client synchronization service 156 selectivelystores a portion of the content associated with the particular useraccount and stores placeholder content items in client storage for theremainder portion of the content. For example, client synchronizationservice 156 can store a placeholder content item that has the samefilename, path, extension, metadata, of its respective complete contentitem on content management system 110, but lacking the data of thecomplete content item. The placeholder content item can be a few bytesor less in size while the respective complete content item might besignificantly larger. After client device 150 attempts to access thecontent item, client synchronization service 156 can retrieve the dataof the content item from content management system 110 and provide thecomplete content item to accessing client device 150. This approach canprovide significant space and bandwidth savings while still providingfull access to a user's content on content management system 110.

Collaboration Features

Another feature of content management system 110 is to facilitatecollaboration between users. Collaboration features include content itemsharing, commenting on content items, co-working on content items,instant messaging, providing presence and seen state informationregarding content items, etc.

Sharing

Content management system 110 can manage sharing content via sharingservice 128. Sharing content by providing a link to the content caninclude making the content item accessible from any computing device innetwork communication with content management system 110. However, insome embodiments a link can be associated with access restrictionsenforced by content management system 110 and access control list 145.Sharing content can also include linking content using sharing service128 to share content within content management system 110 with at leastone additional user account (in addition to the original user accountassociated with the content item) so that each user account has accessto the content item. The additional user account can gain access to thecontent by accepting the content, which will then be accessible througheither web interface service 124 or directly from within the directorystructure associated with their account on client device 150. Thesharing can be performed in a platform agnostic manner. That is, thecontent can be shared across multiple client devices 150 of varyingtype, capabilities, operating systems, etc. The content can also beshared across varying types of user accounts.

To share a content item within content management system 110 sharingservice 128 can add a user account identifier or multiple user accountidentifiers to a content entry in access control list database 145associated with the content item, thus granting the added user accountaccess to the content item. Sharing service 128 can also remove useraccount identifiers from a content entry to restrict a user account'saccess to the content item. Sharing service 128 can record content itemidentifiers, user account identifiers given access to a content item,and access levels in access control list database 145. For example, insome embodiments, user account identifiers associated with a singlecontent entry can specify different permissions for respective useraccount identifiers with respect to the associated content item.

To share content items outside of content management system 110, sharingservice 128 can generate a custom network address, such as a uniformresource locator (URL), which allows any web browser to access thecontent item or collection in content management system 110 without anyauthentication. To accomplish this, sharing service 128 can includecontent identification data in the generated URL, which can later beused to properly identify and return the requested content item. Forexample, sharing service 128 can include the account identifier and thecontent path or a content item identifying code in the generated URL.Upon selection of the URL, the content identification data included inthe URL can be transmitted to content management system 110, which canuse the received content identification data to identify the appropriatecontent item and return the content item.

In addition to generating the URL, sharing service 128 can also beconfigured to record in access control list database 145 that a URL tothe content item has been created. In some embodiments, the contententry associated with a content item can include a URL flag indicatingwhether a URL to the content item has been created. For example, the URLflag can be a Boolean value initially set to 0 or false to indicate thata URL to the content item has not been created. Sharing service 128 canchange the value of the flag to 1 or true after generating a URL to thecontent item.

In some embodiments, sharing service 128 can associate a set ofpermissions to a URL for a content item. For example, if a user attemptsto access the content item via the URL, sharing service 128 can providea limited set of permissions for the content item. Examples of limitedpermissions include restrictions that the user cannot download thecontent item, save the content item, copy the content item, modify thecontent item, etc. In some embodiments, limited permissions includerestrictions that only permit a content item to be accessed from with aspecified domain, i.e., from within a corporate network domain, or byaccounts associated with a specified domain, e.g., accounts associatedwith a company account (e.g., @acme.com).

In some embodiments, sharing service 128 can also be configured todeactivate a generated URL. For example, each content entry can alsoinclude a URL active flag indicating whether the content should bereturned in response to a request from the generated URL. For example,sharing service 128 can only return a content item requested by agenerated link if the URL active flag is set to 1 or true. Thus, accessto a content item for which a URL has been generated can be easilyrestricted by changing the value of the URL active flag. This allows auser to restrict access to the shared content item without having tomove the content item or delete the generated URL. Likewise, sharingservice 128 can reactivate the URL by again changing the value of theURL active flag to 1 or true. A user can thus easily restore access tothe content item without the need to generate a new URL.

In some embodiments, content management system 110 can designate a URLfor uploading a content item. For example, a first user with a useraccount can request such a URL, provide the URL to a contributing userand the contributing user can upload a content item to the first user'suser account using the URL.

Team Service

In some embodiments content management system 110 includes team service130. Team service 130 can provide functionality for creating andmanaging defined teams of user accounts. Teams can be created for acompany, with sub-teams (e.g., business units, or project teams, etc.),and user accounts assigned to teams and sub-teams, or teams can becreated for any defined group of user accounts. Team's service 130 canprovide a common shared space for the team, private user accountfolders, and access limited shared folders. Team's service can alsoprovide a management interface for an administrator to managecollections and content items within team, and can manage user accountsthat are associated with the team.

Authorization Service

In some embodiments, content management system 110 includesauthorization service 132. Authorization service 132 ensures that a useraccount attempting to access a namespace has appropriate rights toaccess the namespace. Authorization service 132 can receive a token fromclient application 152 that follows a request to access a namespace andcan return the capabilities permitted to the user account. For useraccounts with multiple levels of access (e.g. a user account with userrights and administrator rights) authorization service 132 can alsorequire explicit privilege escalation to avoid unintentional actions byadministrators.

Presence and Seen State

In some embodiments, content management system can provide informationabout how users with which a content item is shared are interacting orhave interacted with the content item. In some embodiments, contentmanagement system 110 can report that a user with which a content itemis shared is currently viewing the content item. For example, clientcollaboration service 160 can notify notifications service 117 whenclient device 150 is accessing the content item. Notifications service117 can then notify all client devices of other users having access tothe same content item of the presence of the user of client device 150with respect to the content item.

In some embodiments, content management system 110 can report a historyof user interaction with a shared content item. Collaboration service126 can query data sources such as metadata database 146 and server filejournal 148 to determine that a user has saved the content item, that auser has yet to view the content item, etc., and disseminate this statusinformation using notification service 117 to other users so that theycan know who currently is or has viewed or modified the content item.

Collaboration service 126 can facilitate comments associated withcontent, even if a content item does not natively support commentingfunctionality. Such comments can be stored in metadata database 146.

Collaboration service 126 can originate and transmit notifications forusers. For example, a user can mention another user in a comment andcollaboration service 126 can send a notification to that user that hehas been mentioned in the comment. Various other content item events cantrigger notifications, including deleting a content item, sharing acontent item, etc.

Collaboration service 126 can provide a messaging platform whereby userscan send and receive instant messages, voice calls, emails, etc.

Collaboration Content Items

In some embodiments content management service can also includeCollaborative document service 134 which can provide an interactivecontent item collaboration platform whereby users can simultaneouslycreate collaboration content items, comment in the collaboration contentitems, and manage tasks within the collaboration content items.Collaboration content items can be files that users can create and editusing a collaboration content item editor, and can contain collaborationcontent item elements. Collaboration content item elements may include acollaboration content item identifier, one or more author identifiers,collaboration content item text, collaboration content item attributes,interaction information, comments, sharing users, etc. Collaborationcontent item elements can be stored as database entities, which allowsfor searching and retrieving the collaboration content items. Multipleusers may access, view, edit, and collaborate on collaboration contentitems at the same time or at different times. In some embodiments thiscan be managed by requiring two users access a content item through aweb interface and there they can work on the same copy of the contentitem at the same time.

Collaboration Companion Interface

In some embodiments client collaboration service 160 can provide anative application companion interface for the purpose of displayinginformation relevant to a content item being presented on client device150. In embodiments wherein a content item is accessed by a nativeapplication stored and executed on client device 150, where the contentitem is in a designated location of the file system of client device 150such that the content item is managed by content application 152, thenative application may not provide any native way to display the aboveaddressed collaboration data. In such embodiments, client collaborationservice 160 can detect that a user has opened a content item, and canprovide an overlay with additional information for the content item,such as collaboration data. For example, the additional information caninclude comments for the content item, status of the content item,activity of other users previously or currently viewing the contentitem. Such an overlay can warn a user that changes might be lost becauseanother user is currently editing the content item.

In some embodiments, one or more of the services or storages/databasesdiscussed above can be accessed using public or private applicationprogramming interfaces.

Certain software applications can access content storage 142 via an APIon behalf of a user. For example, a software package such as anapplication running on client device 150, can programmatically make APIcalls directly to content management system 110 when a user providesauthentication credentials, to read, write, create, delete, share, orotherwise manipulate content.

A user can view or manipulate content stored in a user account via a webinterface generated and served by web interface service 124. Forexample, the user can navigate in a web browser to a web addressprovided by content management system 110. Changes or updates to contentin the content storage 142 made through the web interface, such asuploading a new version of a content item, can be propagated back toother client devices associated with the user's account. For example,multiple client devices, each with their own client software, can beassociated with a single account and content items in the account can besynchronized between each of the multiple client devices.

Client device 150 can connect to content management system 110 on behalfof a user. A user can directly interact with client device 150, forexample when client device 150 is a desktop or laptop computer, phone,television, internet-of-things device, etc. Alternatively oradditionally, client device 150 can act on behalf of the user withoutthe user having physical access to client device 150, for example whenclient device 150 is a server.

Some features of client device 150 are enabled by an applicationinstalled on client device 150. In some embodiments, the application caninclude a content management system specific component. For example, thecontent management system specific component can be a stand-aloneapplication 152, one or more application plug-ins, and/or a browserextension. However, the user can also interact with content managementsystem 110 via a third-party application, such as a web browser, thatresides on client device 150 and is configured to communicate withcontent management system 110. In various implementations, theclient-side application 152 can present a user interface (UI) for a userto interact with content management system 110. For example, the usercan interact with the content management system 110 via a file systemexplorer integrated with the file system or via a webpage displayedusing a web browser application.

In some embodiments, client application 152 can be configured to manageand synchronize content for more than one account of content managementsystem 110. In such embodiments client application 152 can remain loggedinto multiple accounts and provide normal services for the multipleaccounts. In some embodiments, each account can appear as folder in afile system, and all content items within that folder can besynchronized with content management system 110. In some embodiments,client application 152 can include a selector to choose one of themultiple accounts to be the primary account or default account.

While content management system 110 is presented with specificcomponents, it should be understood by one skilled in the art, that thearchitectural configuration of system 100 is simply one possibleconfiguration and that other configurations with more or fewercomponents are possible. Further, a service can have more or lessfunctionality, even including functionality described as being withanother service. Moreover, features described herein with respect to anembodiment can be combined with features described with respect toanother embodiment.

While system 100 is presented with specific components, it should beunderstood by one skilled in the art, that the architecturalconfiguration of system 100 is simply one possible configuration andthat other configurations with more or fewer components are possible.

Client Synchronization Service

FIG. 2 shows an example of a client synchronization service 156, inaccordance with some embodiments. According to some embodiments, clientsynchronization service 156 may be implemented in the client device ofFIG. 1. However, in other embodiments, client synchronization service156 may be implemented on another computing device. Clientsynchronization service 156 is configured to synchronize changes tocontent items between a content management system and the client deviceon which client synchronization service 156 runs.

Client synchronization service 156 may include file system interface205, server interface 210, tree storage 220, planner 225, and scheduler230. Additional or alternative components may also be included. Highlevel descriptions of client synchronization service 156 and itscomponents are discussed below with respect to FIG. 2. However, furtherdetails and embodiments of client synchronization service 156 and itscomponents are discussed throughout.

File system interface 205 is configured to process changes to contentitems on the local filesystem of the client device and update the localtree. For example, file system interface 205 can be in communicationwith client synchronization service 156 of FIG. 1 to detect changes tocontent items on the local filesystem of the client device. Changes mayalso be made and detected via client application 152 of FIG. 1. Filesystem interface 205 may make updates to the local tree. The updates tothe local tree may be made based on the changes (new, deleted, modified,copied, renamed, or moved content items) to content items on the clientdevice.

Server interface 210 is configured to aid in the processing of remotechanges to content items at a remote storage of the content managementsystem and updating of the remote tree. For example, server interface210 can be in communication with server synchronization service 112 ofFIG. 1 to synchronize changes to content items between client device 150and content management system 110. Changes (new, deleted, modified,copied, renamed, or moved content items) to content items at contentmanagement system 110 may be detected and updates may be made to theremote tree to reflect the changes at content management system 110.

Tree storage 220 is configured to store and maintain the tree datastructures used by client synchronization service 156. For example, treestorage 220 may store the local tree, the sync tree, and the remotetree. According to some embodiments, tree storage 220 may store the treedata structures in persistent memory (e.g., a hard disk or othersecondary storage device) as well as in main memory (e.g., RAM or otherprimary storage device) in order to reduce latency and response time.For example, on start-up of the client device or client synchronizationservice 156, the tree data structures may be retrieved from persistentmemory and loaded into main memory. Tree storage 220 may access andupdate the tree data structures on main memory and, before the clientdevice or client synchronization service 156 is shut down, tree storage220 may store the updated tree data structures on persistent memory.Because main memory is expensive in cost and often limited in size onmost client devices, additional technological improvements areimplemented to decrease the footprint of the tree data structures onmain memory. These technological solutions are described further below.

Planner 225 is configured to detect differences between the server stateassociated with the content management system and the file system stateassociated with the client device based on the state of the tree datastructures. For example, planner 225 may determine if there is adifference between the remote tree and the sync tree. A differencebetween the remote tree and the sync tree indicates that an actionperformed remotely on one or more content items stored at the contentmanagement system has caused the server state and the file system stateto become out of sync. Similarly, planner 225 may also determine ifthere is a difference between the local tree and the sync tree. Adifference between the local tree and the sync tree indicates that anaction performed locally on one or more content items stored on theclient device has caused the server state and the file system state tobecome out of sync. If a difference is detected, planner 225 generates aset of operations that synchronize the tree data structures.

In some scenarios, a set of operations generated based on a differencebetween the remote tree and the sync tree and a set of operationsgenerated based on a difference between the local tree and the sync treemay conflict. Planner 225 may also be configured to merge the two setsof operations into a single merged plan of operations.

Scheduler 230 is configured to take the generated plan of operations andmanage the execution of those operations. According to some embodiments,scheduler 230 converts each operation in the plan of operations into aseries of one or more tasks that need to be executed in order to performthe operation. In some scenarios, some tasks may become out dated or nolonger relevant. Scheduler 230 is configured to identify those tasks andcancel them.

Tree Data Structures

FIG. 3 shows an example of tree data structures, in accordance withvarious embodiments. The tree data structures may be stored at theclient device and managed by a client synchronization service such asclient synchronization service 156 in FIG. 2. In FIG. 3, the tree datastructures are shown including remote tree 310, sync tree 330, and localtree 350.

Remote tree 310 represents a server state or the state of content itemsstored remotely from the client device (e.g., on a server of the contentmanagement system). Local tree 350 represents a file system state or thestate of the corresponding content items stored locally on the clientdevice. Sync tree 330 represents a merge base for the local tree and theremote tree. The merge base may be thought of as a common ancestor ofthe local tree and the remote tree or a last known synced state betweenthe local tree and the remote tree.

Each tree data structure (e.g., remote tree 310, sync tree 330, or localtree 350) may include one or more nodes. Each node may have one or morechild nodes and the parent-child relationship is represented by an edge.For example, remote tree 310 includes nodes 312 and 314. Node 312 is aparent of node 314 and node 314 is a child of node 312. Thisparent-child relationship is represented by edge 316. A root node, suchas root node 312, does not have a parent node. A leaf node, such as node314, does not have a child node.

Each node in a tree data structure may represent a content item (e.g., afile, document, folder, etc.). For example, root node 312 may representthe root folder associated with the content management system and node314 may represent a file (e.g., a text file named “Foo.txt”) located inthat root folder. Each node in a tree data structure may contain datasuch as, for example, a directory file identifier (“DirFileID”)specifying the file identifier of a parent node of the content item, afile name for the content item, a file identifier for the content item,and metadata for the content item.

As described above, a client synchronization service may determine thatthe server state and the file system state of the client device aresynchronized when all 3 trees (e.g., remote tree 310, sync tree 330, andlocal tree 350) are identical. In other words, the trees aresynchronized when their tree structures and the relationships that theyexpress are identical and the data contained in their nodes areidentical as well. Conversely, the trees are not synchronized if the 3trees are not identical. In the example scenario illustrated in FIG. 3,remote tree 310, sync tree 330, and local tree 350 are shown as beingidentical and synchronized and, as a result, the server state and thefile system state are synchronized.

Tracking Changes Using Tree Data Structures

FIG. 4 shows an example of tree data structures, in accordance withvarious embodiments. As with the tree data structures shown in FIG. 3,the tree data structures shown in FIG. 4 (including remote tree 410,sync tree 430, and local tree 450) may be stored at the client deviceand managed by a client synchronization service such as clientsynchronization service 156 in FIG. 2. In FIG. 4, the tree datastructures are shown.

FIG. 4 shows a scenario after a previously synchronized state, such asthe scenario illustrated in FIG. 3, additional actions are performed onthe content items represented in the trees to modify the content itemssuch that the trees are no longer in sync. Sync tree 430 maintains arepresentation of the previously known synchronized state and may beused by the client synchronization service to identify the differencesbetween the server state and the file system state as well as generateoperations for the content management system and/or the client device toperform to converge so that the server state and the file system stateare synchronized.

For example, a user (the same user as the user associated with theclient device or a different user with access to the content item) maymake modifications to the “foo.txt” content item stored by the contentmanagement system. This content item is represented by node 414 inremote tree 410. The modification shown in the remote tree 410 is aremoval (e.g., a removal of the content item from a space managed by thecontent management system) or delete of the foo.txt content item. Thesemodifications may be performed, for example, on another client deviceand then synchronized to the content management system or performedthrough a web browser connected to the content management system.

When the change is made on the content management system, the contentmanagement system generates modification data specifying the change madeand transmits the modification data to the client synchronizationservice on the client device. For example, using a push model where thecontent management system may transmit or “push” changes to the clientdevice unilaterally. In other implementations, a pull model where theserver sends the changes in response to a request by the client device.Additionally, a hybrid model involving a long pull where the clientdevice initiates the requests but keeps the connection open for a periodof time so the content management system can push additional changes asneeded while the connection is live. The client synchronization serviceupdates the remote tree representing the server state for the contentitems stored by the content management system based on the modificationdata. For example, in remote tree 410, node 414 representing the foo.txtcontent item is shown as deleted.

The client synchronization service may identify a difference betweenremote tree 410 and sync tree 430 and, as a result, determine that amodification of the content items at the content management system hascaused the server state and the file system state to no longer be insync. The client synchronization service may further generate andexecute a set or sequence of operations for the content items stored onthe client device that are configured to converge the server state andthe file system state so that they will be in sync.

Additionally or alternatively, a user (the same user as the userassociated with modifications at the content management system or adifferent user with access to the content item) may make modificationsto the content items stored locally on the client device that areassociated with the content management system. For example, the user mayadd a folder “/bar” to the “/root” folder and add a “Hi.doc” document tothe “/bar” folder.

When the change is made on the client device, the client device (e.g.,client synchronization service 156 or client application 152 of FIG. 1)generates modification data specifying the change made. The clientsynchronization service updates the local tree representing the filesystem state for the content items stored on the client device based onthe modification data. For example, in local tree 450, node 452 and node454 are shown as added. Node 452 and node 454 represent the “/bar”folder and the “Hi.doc” document respectively.

The client synchronization service may identify a difference betweenlocal tree 450 and sync tree 430 and, as a result, determine that amodification of the content items at the client device has caused theserver state and the file system state to no longer be in sync. Theclient synchronization service may further generate a set or sequence ofoperations for the content items stored by the content management systemthat are configured to converge the server state and the file systemstate so that they will be in sync. These operations may be transmittedto the content management system for execution.

As seen in FIG. 4, modifications to content items stored on the clientdevice and content items stored by the content management system mayoccur at substantially the same time or within a particular time period.These modifications can be reflected in the tree data structures andused by the client synchronization service to generate operations forthe client device and for the content management system in parallel. Inother scenarios, however, modifications may not necessarily occur withinthe same time period and operations may be generated in an as-neededmanner. Furthermore, although FIG. 4 illustrates scenarios for addingcontent items and deleting content items, other types of modificationssuch as, editing, renaming, copying, or moving content items are alsosupported.

According to various embodiments, identifying a difference between twotree data structures and generating operations may involve checking eachnode in both tree data structures and determining whether an action hasbeen performed on the node. The actions may include, for example, theaddition of the node, the deletion of the node, the editing of the node,or the moving of the node. These actions may then be used to generatethe operations configured to converge the server state and the filesystem state.

For example, if the two tree data structures are a sync tree and aremote tree, the client synchronization service may identify each nodein the sync tree by, for example, requesting the file identifiers of allnodes in the sync tree. For each node or file identifier for the node inthe sync tree, the client synchronization service may determine if thenode or file identifier is also in the remote tree. A node or fileidentifier in the sync tree that is not found in the remote tree mayindicate that the node has been deleted from the server state that isrepresented by the remote tree. Accordingly, the client synchronizationservice may determine that a delete action has occurred on the remotetree. If the node or file identifier for the node is found in the remotetree, the client synchronization service may check whether the node inthe remote tree has been edited or moved.

To determine whether the node in the remote tree has been edited withrespect to the node in the sync tree, the client synchronization servicemay compare the metadata for the node in the sync tree with the metadatafor the corresponding node (e.g., the node with the same fileidentifier) in the remote tree. The metadata may include informationthat may be used to determine whether the content item represented bythe node has been edited. For example, the metadata may include one ormore hash values that are generated based on the data in the contentitem or a portion thereof. The metadata may additionally oralternatively include a size value, a last modified value, or othervalue for the content item. The metadata for the node in the sync treemay be compared with the metadata for the node in the remote tree. Ifthe metadata do not match, an edit of the content item may have beenedited in the server state represented by the remote tree. Accordingly,the client synchronization service may determine that an edit action hasoccurred for the node on the remote tree. If the metadata matches, noedit may have occurred.

To determine whether the node in the remote tree has been moved, theclient synchronization service may compare the location for the node inthe sync tree with the location for the corresponding node (e.g., thenode with the same file identifier) in the remote tree. The location mayinclude, for example, a path where the node is located, a file name,and/or a directory file identifier (“DirFileID”) specifying the fileidentifier of the node's parent. If the locations match, no move mayhave occurred. On the other hand, if the locations do not match, a moveof the content item may have occurred in the server state represented bythe remote tree. Accordingly, the client synchronization service maydetermine that a move action has occurred for the node on the remotetree.

To determine whether a node has been added to the remote tree, theclient synchronization service may identify any nodes or fileidentifiers in the remote tree that are not found in the sync tree. If anode or file identifier is found in the remote tree and not found in thesync tree, the client synchronization service may determine that an addaction of this node has occurred on the remote tree representing theserver state.

Although the example above is described with respect to the sync treeand the remote tree, in other embodiments, a similar process may occurwith the sync tree and a local tree in order to identify a differencebetween the sync tree and the local tree and determine which actionshave occurred on the local tree representing the file system state.

Synchronization Using Tree Data Structures

FIG. 5 shows an example method for synchronizing a server state and afile system state using tree data structures, in accordance with variousembodiments of the subject technology. Although the methods andprocesses described herein may be shown with certain steps andoperations in a particular order, additional, fewer, or alternativesteps and operations performed in similar or alternative orders, or inparallel, are within the scope of various embodiments unless otherwisestated. The method 500 may be implemented by a system such as, forexample, client synchronization service 156 of FIG. 2, running on aclient device.

The system is configured to identify a difference between a remote treerepresenting a server state for content items stored by the contentmanagement system, a local tree representing the file system state forthe corresponding content items stored on the client device, and a synctree representing a known synced state between the server state and thefile system state. Based on these differences, a set of operations maybe generated that, if executed, are configured to converge the serverstate and the file system state towards a synchronized state where thethree tree data structures would be identical.

For example, at operation 505, the system may receive modification datafor content items stored by a content management system or on a clientdevice. The modification data may be used to update a remote tree or alocal tree at operation 510.

The modification data specifies what changes occurred to one or morecontent items associated with a content management service. Accordingly,the modification data may be received from the content management systemor from the client device (e.g., from client application 152 running onclient device 150 in FIG. 1). Modification data received from thecontent management system may be referred to as server modificationdata. Server modification data specifies what changes are done to one ormore content items by the content management system and may be used toupdate the remote tree at operation 510. Modification data received fromthe client device may be referred to as client modification data. Clientmodification data specifies what changes are done to one or more contentitems on the client device and may be used to update the local tree atoperation 510.

At operation 515, the system may determine whether a server state forcontent items stored by the content management system and a file systemstate for the content items stored on the client device are in sync.Because the local tree and the remote tree are representative of thefile system state and the server state and are continually being updatedto track changes that occur at the content management system and theclient device, determining whether the server state and the file systemstate are in sync may be done by comparing the local tree and/or theremote tree to the sync tree to find differences between the trees. Thisprocess of finding differences between the trees is sometimes referredto as “diffing” the trees.

According to some embodiments and scenarios, determining whether theserver state and the file system state are in sync may include one ormore of identifying differences between the remote tree and the synctree and/or identifying differences between the local tree and the synctree. Differences between the remote tree and sync tree may indicate theoccurrence of changes to content items stored by the content managementsystem that may not be reflected at the client device. Similarly,differences between the local tree and sync tree may indicate theoccurrence of changes to content items stored at the client device thatmay not be reflected at the content management system.

If there are no differences between the trees, the server state and thefile system state are in sync and no synchronization actions are needed.Accordingly, the method may return to operation 505 and await newmodification data. On the other hand, if differences are detected, thesystem may generate a set of operations configured to converge theserver state and the file system state at operation 520.

The set of operations generated depends on the one or more differencesthat are detected. For example, if the difference between two trees isan added content item, the generated set of operations may includeretrieving the added content item and adding it. If the differencebetween two trees is a deletion of a content item, the generated set ofoperations may include deleting the content item. According to someembodiments, the set of operations may also include a number of checksto ensure tree constraints are maintained. As will be described furtherbelow, the set of operations may conflict with the current state of theserver state, the file system state, or other operations that arepending execution. Accordingly, the system may also resolve theseconflicts before proceeding.

As noted above, if there are differences between the remote tree andsync tree, changes to content items stored by the content managementsystem may have occurred that may not be reflected at the client device.Accordingly, in this scenario, the system may generate a client set ofoperations configured to operate on the content items stored on theclient device to converge the server state and the file system state andthis client set of operations may be provided to the client device forexecution at operation 525.

Similarly, if there are differences between the local tree and synctree, changes to content items stored at the client device may haveoccurred that may not be reflected at the content management system.Accordingly, in this scenario, the system may generate a server set ofoperations configured to operate on the content items stored by thecontent management system to converge the server state and the filesystem state and this server set of operations may be provided to thecontent management system for execution at operation 525. In some cases,both cases may be true and a client set of operations and a server setof operations may be generated and provided to their intended recipientsat operation 525.

Once the set(s) of operations are provided to the intended recipient(s),the method may return to operation 505 and await new modification data.The set(s) of operations may provide one or more steps towards theconvergence of the server state and the file system state or provide allsteps needed to sync the server state and the file system state. Forexample, the content management system may receive the server set ofoperations and execute the server set of operations on content itemsstored by the content management system. This execution of the serverset of operations causes changes to the content items stored by thecontent management system, which are detected and specified in servermodification data, which is transmitted back to the system. The systemmay then update the remote tree and determine whether the server stateand the file system state are in sync.

The client device may receive the client set of operations and executethe client set of operations on content items stored on the clientdevice. This execution of the client set of operations causes changes tothe content items stored on the client device, which are detected andspecified in client modification data, which is passed to the system.The system may then update the local tree and determine whether theserver state and the file system state are in sync. These operations ofmethod 500 may continue until the server state and the file system stateare in sync.

The operations of method 500 are described with respect to a client sideand a server side (e.g., a local tree and a remote tree, a file systemstate and a server state, a client set of operations and a server set ofoperations, client modification data and server modification data). Invarious embodiments the operations associated with the two sides mayoccur in parallel, in sequence, in isolation of the other side, or acombination.

As will be discussed in further detail, in accordance with someembodiments, before the operations are provided for execution, thesystem may check the operations to determine whether they comply with aset of rules or invariants. If an operation violates a rule, the systemexecutes a resolution process associated with the violation of the rule.

Additionally, in accordance with some embodiments, the system (e.g.,scheduler 230 of client synchronization service 156 in FIG. 2) maymanage the execution of the set of operations. For example, eachoperation in the set of operations may be associated with a task, anexecution thread, series of steps, or instructions. The system may beconfigured to execute the task, thread, step, or instructions andinterface with the client device and/or the content management system toexecute the set of operations and converge the server state and the filesystem state.

Conflict Handling

As described above with respect to FIG. 5, differences between a synctree and a remote tree are identified and used to generate a client setof operations configured to converge the server state and the filesystem state. However, in some cases, the client set of operations mayconflict with the current state of a local tree. Similarly, differencesbetween the sync tree and the local tree are identified and used togenerate a server set of operations configured to converge the serverstate and the file system state. However, the server set of operationsmay conflict with the current state of the remote tree. Additionally oralternatively, the client set of operations and the server set ofoperations may conflict with one another or violate another rule orinvariant maintained by the system. Accordingly, various embodiments ofthe subject technology provide additional technical improvements byresolving these conflicts.

For example, planner 225 in client synchronization service 156 of FIG. 2may identify an operation in a set of operations (e.g., the client setof operations or the server set of operations) that conflicts with arule. Each rule used to identify a conflict may also be associated witha resolution for the conflict. The client synchronization service mayupdate the set of operations based on the resolution for the conflict orresolve the conflict by performing operations associated with theresolutions for the conflict before providing the set of operations forexecution.

FIG. 6 shows an example method 600 for resolving conflicts whensynchronizing a server state and a file system state using tree datastructures, in accordance with various embodiments of the subjecttechnology. Although the methods and processes described herein may beshown with certain steps and operations in a particular order,additional, fewer, or alternative steps and operations performed insimilar or alternative orders, or in parallel, are within the scope ofvarious embodiments unless otherwise stated. The method 600 may beimplemented by a system such as, for example, client synchronizationservice 156 of FIG. 2, running on a client device.

The system may receive a set of operations configured to converge aserver state and a file system state at operation 620. The set ofoperations may be, for example, the client set of operations, the serverset of operations, or a combined set of operations generated anddescribed with respect to the method 500 of FIG. 5.

At operation 650, the system identifies one or more violations in theset of operations based on a set of rules. The set of rules may bestored by client synchronization service 156 in FIG. 2 and specify anumber of constraints, invariants, or conflicts for operations that areto be resolved. The set of rules may be applied to the tree datastructures and help control synchronization behavior. Each rule in theset of rules may also be associated or otherwise linked to a resolutionto a violation of that rule. For example, the resolution may include analteration of one or more operations in the set of operations, a removaloff one or more operations, an addition of one or more operations, oneor more additional actions to the server state or the file system state,or a combination of actions.

For each operation in a set of operations, the system may determinewhether any rule in the set of rules is violated. If a rule is violated,the system identifies a resolution of the violation and, at operation655, performs the resolution. The resolution may include actions such asmodifying one or more operations in the set of operations, a removing oradding one or more operations, or additional actions on the server stateor the file state.

Once the resolution actions are performed, the system may generate aresolved or rebased set of operations based on the resolution and theset of operations at operation 660 and, at operation 665, provide theresolved set of operations to the appropriate entity for execution. Forexample, the resolved set of operations may be provided to scheduler 230of client synchronization service 156 in FIG. 2 for managed execution.Alternatively, if the set of operations is a client set of operations,the resolved set of operations may be provided to the client device. Ifthe set of operations is a server set of operations, the resolved set ofoperations may be provided to the content management service.Additionally, the method 600 of FIG. 6 may be performed on client set ofoperations and server set of operations in sequence, in parallel, or invarious different orders.

According to some embodiments, each type of operation may be associatedwith the same or a different set of rules. For example, operation typesmay include, for example, adding a content item, deleting a contentitem, editing a content item, moving a content item, renaming a contentitem, etc. The set of operations may consist of operations eachbelonging to one of the operation types above. Each operation type maybe associated with a specific set of rules.

For illustrative purposes, a set of rules for an “Add” operation typemay include rules such as file identifiers for content items must beunique in a tree (e.g., no two nodes in a tree may have the same fileidentifier), a directory file identifier (“DirFileID”) specifying thefile identifier of a parent node of the content item must exist in theopposite tree data structure, and a DirFileID and file name combinationfor a content item are not used in the opposite tree.

Opposite tree, as used here, refers to the tree data structure thatrepresents the state of the opposing entity. For example, a client setof operations configured to operate on the client device and theresulting changes to the file system on the client device will bereflected in the local tree. Accordingly, the opposite tree for theclient set of operations is the remote tree. Similarly, a server set ofoperations is configured to be transmitted to the content managementsystem to be executed and the resulting changes to the server state willbe reflected in the remote tree. Accordingly, the opposite tree for theserver set of operations is the local tree.

FIG. 7 shows an example of tree data structures illustrating a violationof a rule for an add operation, in accordance with various embodiments.The tree data structures include remote tree 710, sync tree 750, andlocal tree 770. When referencing the local tree 770, the remote tree 710may be considered the opposite tree. On the other hand, when referencingthe remote tree 710, the local tree 770 may be considered the oppositetree. FIG. 7 illustrates a set of operations adding the content itemrepresented by node 712 in remote tree 710. For example, a clientsynchronization service may compare remote tree 710 with sync tree 750,identify the differences, and generate a set of operations that includesthe addition of node 712. Node 712 is associated with a FileID of 4, aDirFileID of 3 (which references parent node 714, which is node 712'sparent), and a file name of “Hi.” Parent node 714 is associated with aFileID of 3, a DirFileID of 1 (which references root node 716, which isnode 714's parent), and a file name of “Foo.”

The client synchronization service may perform the method 600 of FIG. 6and determine that the add operation for node 712 violates the “adirectory file identifier (“DirFileID”) of the content item must existin the opposite tree data structure” rule for “add” operation types.This is illustrated in FIG. 7 by the local tree 770 not having a nodewith a file ID of 3, which references parent node 714 of node 712. Thismay occur when, for example, after differences between remote tree 710and sync tree 750 are determined and a set of operations is generated,the “Foo” node corresponding to node 714 is removed from the oppositetree.

The resolution associated with this rule may include deleting the nodemissing from local tree 770 from sync tree 750 to synchronize sync tree750 and local tree 770 and rediffing (e.g., finding the differencebetween) remote tree 710 and sync tree 750. In the scenario illustratedin FIG. 7, node 754 in sync tree 750 would be removed 758 and diffingoperations would commence to identify differences between remote tree710 and sync tree 750. This would result in the inclusion of an addoperation of node 714 as well as an add operation for node 712 in theset of operations.

Similarly, a violation of the “file identifiers for content items mustbe unique in a tree” rule for “add” operation types may be resolved byoperations including requesting, from the content management system, anew file ID for the node being added and using the new file ID whenadding the node. A violation of the “DirFileID and file name combinationfor a content item are not used in the opposite tree” rule for “add”operation types may be resolved by operations including checking via themetadata associated with the two nodes whether the content items are thesame. If the content items are the same, it is likely that the contentitem being added has already been added in other actions. If the contentitems are not the same, the file name for the content item being addedcan be renamed. For example, the file name for the content item beingadded can be appended with the text “(conflicted version).”

Incremental Planner

Although the various tree data structures shown in FIGS. 3, 4, and 7contain a relatively small number of nodes and are relatively simple instructure, the tree data structures supported by the system may be muchlarger and complex with multiple levels and potentially large number ofnodes at each level. Accordingly the memory usage required to store thetree data structures during operation may be quite large and thecomputing time and resources required to operate on the tree datastructures may be quite large. For example, finding differences betweena remote tree and a sync tree and/or a local tree and the sync tree andgenerating operations needed to converge the remote tree and the synctree and/or the local tree and the sync tree may require a large amountof memory, time, and other computing resources.

Unfortunately, these computing resources are limited. For example, aclient device may have a limited amount of available memory and thelength of time needed to diff trees and generate operations may hinderthe usability of the client device, the client application, or thecontent management services provided by the content management system.Furthermore, the more time needed to converge the server state and thefile system state, the more likely that intervening changes to eitherstate may render the set of operations being computed or executed and/orthe target sync state out of date. Accordingly, various embodiments ofthe subject technology provide additional technical improvements byincrementally converging the server state and the file system statealong with the tree data structures that represent them.

FIG. 8 shows an example method 800 for incrementally converging a serverstate and a file system state, in accordance with various embodiments ofthe subject technology. Although the methods and processes describedherein may be shown with certain steps and operations in a particularorder, additional, fewer, or alternative steps and operations performedin similar or alternative orders, or in parallel, are within the scopeof various embodiments unless otherwise stated. The method 800 may beimplemented by a system such as, for example, client synchronizationservice 156 of FIG. 2, running on a client device.

At operation 805, the system may receive modification data that may beused to update either a remote tree or a local tree. For example, servermodification data may be received from a content management system thatspecifies modifications or other actions (e.g., an edit, add, delete,move, or rename) associated with one or more content items stored by thecontent management system. The server modification data may be used toupdate the remote tree, which represents the server state of contentitems stored by the content management system. Similarly, clientmodification data may be received from the client device (e.g., a clientapplication) and specify modifications or other actions associated withone or more content items stored on the client device. The clientmodification data may be used to update the local tree, which representsthe file system state of content items stored on the client device.

Based on the received modification data specifying modificationsassociated with content items, the system may identify nodes thatcorrespond to the modified content items and add the nodes to a list ofmodified content items (e.g., add the file identifier associated withthe nodes to the list of modified content items) at operation 810.Operations 805 and 810 may continuously occur for some time before thesystem proceeds to the next stage of the method 800. For exampleadditional modification data may be received and used to update thetrees managed by the system and add nodes to the list of modifiedcontent items.

In order to incrementally converge the server state and the file systemstate, the system takes each node in the list of modified content itemsand determines how the node was modified (e.g., which actions areassociated with the node) at operation 815. In some embodiments, themodification data may specify the modification to the node. However, inother embodiments, the system may determine the modifications to thenode based on a comparison of the remote tree with the sync tree and/ora comparison of the local tree with the sync tree. For example, themodifications may include the addition of the node, the deletion of thenode, the editing of the node, or the moving of the node.

For each node or file identifier for the node in the list of modifiedcontent items, the system may perform a series of checks to determinewhat, if any, modifications were performed on the node. For example, thesystem may determine whether the file identifier is in the sync tree butnot in the remote tree. A file identifier in the sync tree that is notfound in the remote tree may indicate that the node has been deletedfrom the server state that is represented by the remote tree.Accordingly, the client synchronization service may determine that adelete modification on the node has occurred on the remote tree.Similarly, the system may also determine whether the file identifier isin the sync tree but not in the local tree. A file identifier in thesync tree that is not found in the local tree may indicate that the nodehas been deleted from the file system state that is represented by thelocal tree. Accordingly, the client synchronization service maydetermine that a delete modification on the node has occurred on thelocal tree.

To determine whether an edit modification has been performed on thenode, the system may compare the metadata for the node in the sync treewith the metadata for the corresponding node (e.g., the node with thesame file identifier) in the remote tree and/or the local tree. Themetadata may include information that may be used to determine whetherthe content item represented by the node has been edited. For example,the metadata may include one or more hash values that are generatedbased on the data in the content item or a portion thereof. The metadatamay additionally or alternatively include a size value, a last modifiedvalue, or other value for the content item. If the metadata do notmatch, an edit of the content item may have been edited in the serverstate represented by the remote tree and/or the file system staterepresented by the local tree. Accordingly, the system may determinethat an edit action has occurred for the node on the remote tree and/orthe local tree.

To determine whether the node in the remote tree has been moved, thesystem may compare the location for the node in the sync tree with thelocation for the corresponding node (e.g., the node with the same fileidentifier) in the remote tree and/or the local tree. The location mayinclude, for example, a path where the node is located, a file name,and/or a directory file identifier (“DirFileID”) specifying the fileidentifier of the node's parent. If the locations match, no move mayhave occurred. On the other hand, if the locations do not match, a moveof the content item may have occurred in the remote tree or the localtree. Accordingly, the client synchronization service may determine thata move action has occurred for the node on the remote tree and/or thelocal tree.

To determine whether a node has been added to the remote tree, thesystem may determine if the file identifier in the list of modifiedcontent items is in the remote tree or in the local tree, but not in thesync tree. If the file identifier is found in the remote tree or thelocal tree and not found in the sync tree, the system may determine thatan add modification for this node has occurred.

Once the one or more modifications to the nodes in the list of modifiedcontent items are determined, the system may determine whether any ofthose modifications have dependencies at operation 820. As will beillustrated further with respect to FIG. 9, a modification on a node hasa dependency when, for example, the modification cannot execute withoutanother modification occurring first.

If the modification does not have a dependency, the system adds themodification to an unblocked list of actions at operation 825. If themodification has a dependency, the modification is blocked for the timebeing at operation 830 and cannot be executed without anothermodification being processed first. Accordingly the process returns tooperation 805 to await further modifications. After each of themodifications are processed, the system may clear the file identifiersassociated with the modifications from the list of modified contentitems.

FIG. 9 shows an example of tree data structures, in accordance withvarious embodiments. The tree data structures shown in FIG. 9 may bestored at the client device and managed by a system such as clientsynchronization service 156 in FIG. 2. For the purpose of illustration,only remote tree 910 and sync tree 950 are shown in FIG. 9 anddescribed. Similar operations and description may also be applied to alocal tree as well.

Remote tree 910 includes root node 912 with a file identifier of 1, node914 with a file identifier of 5 and file name of “Foo,” node 916 with afile identifier of 6 and file name of “Bar,” and node 918 with a fileidentifier of 7 and file name of “Bye.” Sync tree includes root node 952with a file identifier of 1.

Based on the tree data structures shown in FIG. 9, the system may haveidentified that nodes with file identifiers of 5, 6, and 7 have beenmodified at operation 810 and added the nodes to the list of modifiedcontent items, as illustrated by reference 980 in FIG. 9. At operation815, the system determines the list of modifications to nodes in thelist of modified content items. As is seen by the comparison of remotetree 910 and sync tree 950, nodes 914, 916, and 918 have been added toremote tree 910. More specifically, as illustrated by reference 982 inFIG. 9, node 916 with file identifier 6 and name “Bar” has been added asa child to node 914 with file identifier 5. This is represented by the“Add(6, 5, Bar)” entry in reference 982. Node 918 with file identifier 7and name “Bye” has been added as a child to node 914 with fileidentifier 5. This is represented by the “Add(7, 5, Bye)” entry inreference 982. Node 914 with file identifier 5 and name “Foo” has beenadded as a child to root node 912 with file identifier 1. This isrepresented by the “Add(5, /root, Foo)” entry in reference 982.

At operation 820, the system determines that the add modification ofnode 914 does not have a dependency and, as a result, is unblocked.Accordingly, the system adds the modification associated with node 914(e.g., the modification represented by the “Add(5, /root, Foo)”) entryin reference 982) to an unblocked list of actions at operation 825. Thisis seen in references 984 in FIG. 9. On the other hand, themodifications for nodes 916 and 918 represented by the “Add(6, 5, Bar)”and the “Add(7, 5, Bye)” entries in reference 982 are dependent on themodification represented by the “Add(5, /root, Foo)” occurring first. Inother words, node 916 and/or node 918 cannot be added until node 914 isadded. Accordingly, these modifications are included in a blocked listof actions illustrated by reference 986 in FIG. 9.

Returning to the method 800 of FIG. 8, at operation 835, the system mayselect a set of modifications from the unblocked list of actions andgenerate a set of operations based on the selected set of modifications.The set of operations is configured to converge the server state and thefile system state. The set of operations generated depends on theselected set of modifications from the unblocked list. For example, ifthe selected set of modifications includes the add modificationassociated with node 914 (e.g., the modification represented by the“Add(5, /root, Foo)”) entry in reference 984) in FIG. 9, the generatedset of operations may include retrieving the added content item from thecontent management system and adding it to the local file system of theclient device.

According to some embodiments, the system may select all modificationsfrom the unblocked list of actions to generate one or more sets ofoperations. However, in some scenarios, the number of modifications inthe unblocked list may be quite high and the computing resources (e.g.,memory and processing time) needed to process all of the modificationsis substantial. In order to reduce these technological burdens, thesystem may select a smaller set of the modifications in the unblockedlist of actions in order to process incrementally. For example, thesystem may select the first or top X number or percent of modificationsto generate operations. In further iterations of the process, theremaining modifications in the unblocked lists may be processed.

In some embodiments, the modifications in the unblocked list may beranked for processing. The modifications may be ranked based on, forexample, a modification type (e.g., delete modifications are prioritizedover add modifications), metadata associated with the modification(e.g., add modifications of content items of smaller size areprioritized over add modifications of content items of larger size,delete modifications of content items of larger size are prioritizedover delete modifications of content items of smaller size, etc.).

These rank rules may be stored by the system and may be designed toachieve various performance goals for content synchronization. Forexample, delete modifications may be prioritized over add modificationsin order to free as much of potentially limited storage space for a userbefore new content items may be added. Adding of smaller content itemsmay be prioritized over larger content items in order to provide as muchprogress with respect to the number of content items added as soon aspossible.

At operation 835, the system may provide the set of operations to thecontent management system and/or the client device. As noted above,modifications associated with actions performed by the contentmanagement system may not be reflected at the client device.Accordingly, in this scenario, the system may generate a client set ofoperations configured to operate on the content items stored on theclient device to converge the server state and the file system state andthis client set of operations may be provided to the client device forexecution at operation 835.

On the other hand, modifications associated with actions performed bythe client device may not be reflected at the content management system.Accordingly, in this scenario, the system may generate a server set ofoperations configured to operate on the content items stored by thecontent management system to converge the server state and the filesystem state and this server set of operations may be provided to thecontent management system for execution at operation 835.

In some cases, both cases may be true and a client set of operations anda server set of operations may be generated and provided to theirintended recipients at operation 835. The set of operations may alsoinclude a number of checks to ensure tree constraints are maintained.For example, the set of operations may resolve various conflicts orconstraints as discussed with respect to FIG. 6.

Once the set(s) of operations are provided to the intended recipient(s),the method may return to operation 805 and await new modification data.For example, with respect to the scenario illustrated in FIG. 9, the setof operations may include retrieving the content item associated withnode 914 from the content management system and adding it to the localfile system of the client device. This would result in the addition of anode corresponding to node 914 in the local tree (not shown in FIG. 9)and sync tree 950. On the next iteration of process 800 of FIG. 8, theadd modifications of node 916 and node 918 represented by the “Add(6, 5,Bar)” and the “Add(7, 5, Bye)” entries in reference 982 are no longerblocked because their parent, node 914, has already been added to thesync tree. Accordingly, the add modifications of node 916 and node 918represented by the “Add(6, 5, Bar)” and the “Add(7, 5, Bye)” entries inreference 982 may be added to the unblocked list of actions and used togenerate one or more sets of operations configured to converge theserver state and the file system state.

The set(s) of operations may provide one or more steps for theincremental convergence of the server state and the file system state.Although implementing an incremental process may be more complex attimes, the incremental process may achieve a reduction in processingtime and reduction in the memory required. These and other initialtechnological improvements naturally lead to additional technologicalimprovements. For example, because processing time is reduced, thelikelihood of additional changes from the client device or the contentmanagement system making certain modifications obsolete or out of datais reduced as well.

With respect to FIG. 9, various groupings of content items,modifications, actions, or file identifiers are described as lists forthe purpose of illustration. Other types of data structures are alsocompatible. For example, the unblocked list of actions may beimplemented as a B-tree data structure in order to keep data sorted andallow searches, sequential access, insertions, and deletions inlogarithmic time.

Scheduler

In some embodiments, a client synchronization service may generate a setor sequence of operations configured to converge the server state andthe file system state and provide the operations to the contentmanagement system or client device for execution. However, in somescenarios, changes on the file system of the client device or on thecontent management system may cause the generated set of operations tobecome out of date or obsolete while the set of operations is in theprocess of executing. Various embodiments are directed to providing atechnical solution to these and other technical problems. For example,the client synchronization service may be configured to monitor changeson the file system of the client device or on the content managementsystem and update the client device and/or content management system asneeded. Furthermore, the client synchronization service may beconfigured to improve performance and reduce processing times byallowing for concurrent execution of operations.

According to some embodiments, planner 225 of client synchronizationservice 156 shown in FIG. 2 may generate a plan or plan of operationsthat consists of an unordered set of operations. All operations within aplan have no dependencies and, as a result, are able to be executedconcurrently in separate threads or in any order. The operations in theplan, according to some embodiments, are abstract instructions that maybe taken by the content management system and/or the client device inorder to converge the states and tree data structures. Exampleinstructions may include a remote or local add of a content item, aremote or local delete of a content item, a remote or local edit of acontent item, or a remote or local move of a content item.

Scheduler 230 of client synchronization service 156 shown in FIG. 2 maybe configured to receive the plan of operations from planner 225, managethe execution of the operations in the plan, determine if the plan hasbeen updated or changed, and manage the execution of the updated orchanged plan. For example, scheduler 230 may coordinate with file systeminterface 205 and server interface 210 to execute the tasks and stepsneeded to implement operations in the plan. This may include receivingconfirmations from the file system or content management system or errorhandling activities such as handling retries when there is no networkconnectivity or when a content item is locked by some other application.

Each operation may be implemented by a script or thread referred to as atask. The task coordinates the application of an associated operationand may include one or more steps needed to implement the operation. Forexample, a “local add operation” may indicate that a content item hasbeen added to the local file system of the client device and, as aresult, the content item should be added at the content managementsystem in order to synchronize the server state and the file systemstate. Accordingly, the local add operation may be associated with a“local add task” that includes one or more steps needed to implement thelocal add operation. The steps may include one or more of notifying thecontent management system of the new content item, uploading the contentitem to the content management system in one or more blocks of data,confirming that all blocks of data have been received by the contentmanagement system, making sure the content item is not corrupted,uploading metadata for the content item to the content managementsystem, and committing the adding of the content item to the appropriatelocation at the content management system.

A task may begin execution, suspend at well-defined points while waitingon the completion of other events, resume when the events have occurred,and eventually terminate. According to some embodiments, scheduler 230is configured to cancel, regenerate, or replace tasks. For example,based on changes to the server state or the file system state, a taskmay become stale before it is executed and scheduler 230 may cancel thestale task before it is executed.

As described above, planner 225 may generate a plan of operations basedon a set of tree data structures (e.g., a remote tree, a sync tree, anda local tree). Over time, planner 225 continues to generate plans ofoperations based on the status of the tree data structures. If the treedata structures change to reflect the state of the server state and thefile system state, planner 225 may also generate a new updated plan thatdiffers from a previous plan. Scheduler 230 executes each plan ofoperations generated by the planner 225.

In some scenarios, changes in the operations of a subsequent plan maycause unintended synchronization behaviors conflicts with an operationin the previous plan that is in the process of execution. For example,as operations in a first plan are being executed, one or more of theoperations are canceled (or are not present) in the second plan. Toillustrate, FIG. 10 shows an example scenario in which, at time t1, theserver state represented by the remote tree and the file system staterepresented by the local tree are synchronized as shown by the remotetree, the sync tree, and the local tree all matching. Based on thissynchronized state, planner 225 may generate a plan with no operations(e.g., an empty plan) at t1 or not generate a plan of operations.

A user on the client device may delete content item A from the localfile system or move content item A out of a folder managed by clientsynchronization service 156, which is reflected by the removal of node Afrom the local tree at time t2. Planner 225 may generate a plan thatincludes operation LocalDelete(A) based on the state of the tree datastructures at time t2. Scheduler 230 may initiate the task or stepsrequired to implement the LocalDelete(A) operation. These steps mayinclude transmitting instructions to the content management system todelete content item A.

After instructions to delete content item A are transmitted to thecontent management system, the user on the client device may undo thedelete of content item A or move content item A back to the previouslocation. The local tree is updated based on this new action at time t3and planner may generate a new plan that is empty with no operations.Once again, the tree data structures match and the system is in asynchronized state at time t3.

However, because instructions to delete content item A were transmittedto the content management system, the content management system deletescontent item A from the server state. Although scheduler 230 may attemptto cancel the deletion of content item A, the instructions may havealready been transmitted and completed by the content management system.This change in the server is communicated to client synchronizationserver 156, which updates the remote tree by deleting node A at time t4.Planner 225 could notice the change in the remote tree and thedifference between the remote tree and the sync tree and determine thatcontent item A was removed at the server state. Accordingly, planner 225would create a plan with a RemoteDelete(A) operation at time t4. In aneffort to synchronize the server state and the file system state,content item A would eventually be deleted from the client device andthe local tree.

Problematically, the removal of content item A from the server state,the generation of the RemoteDelete(A) operation, and the eventualremoval of content item A from the file system state are all notintended and may cause further problems down the line for the user.Furthermore, in some cases, applications or processes may also accesscontent items and unintentional synchronization behavior may cause acascade of additional technical issues. Various embodiments are directedto preventing unintended consequences in synchronization of contentitems between a server state and a file system state.

According to some embodiments, when canceling a task for a staleoperation that is no longer in a plan of operations, scheduler 230 maywait for the cancellation to be completed before proceeding to initiatethe execution of other tasks. For example, scheduler 230 may wait toreceive confirmation of the cancellation from the client device or thecontent management system before proceeding with other tasks. Scheduler230 may determine whether the task has been initiated and if the taskhas not been initiated, scheduler may cancel the task and confirm thatthe task is no longer awaiting execution. If the task has beeninitiated, the confirmation may come from the client device or thecontent management system and notify the scheduler that all of the stepsassociated with the canceled task have been undone. According to someimplementations, scheduler 230 does not allow for cancellation of a taskonce it has been initiated. This may be the case for all tasks or acertain subset of tasks or task types (e.g., a commit task that sends anupdate on the file system state to the content management system forsynchronization with the server state).

In order to improve performance and allow for concurrent execution oftasks as well as the cancellation of tasks, scheduler 230 may also beconfigured to manage the execution and cancellation of tasks based ondifferences between a first plan of operations and an updated secondplan of operations. FIG. 11 shows an example Venn diagram 1100representation of two plans of operations, in accordance with variousembodiments of the subject technology. Planner 225 may generate a plan 11110 with a first set of operations, receive an update to the tree datastructures, and generate an updated plan 2 1120 with a second set ofoperations.

Plan 1 1110 and plan 2 1120 may share a number of common operations,which is represented by portion 1130 of the Venn diagram 1100. Plan 11110 and plan 2 1120 may also share a number of operations that are notin common. For example, operations in plan 1 1110 that are not in plan 21120 are stale and no longer current based on the update to the treestructures detected by planner 225. These stale operations of plan 11110 are represented by portion 1140 of Venn diagram 1100. Newoperations in plan 2 1120 that are not in plan 1 1110 are represented byportion 1150. Each of portions 1130, 1140, and 1150 which represent thedifferences and commonalties between plan 1 1110 and plan 2 1120 mayinclude no operations or many operations depending on the updates to theserver state and the file system state that are reflected in the treedata structures.

Because the operations in portion 1140 are no longer in the most recentplan, scheduler 230 may cancel tasks associated with these operations.In order to prevent unintended synchronization behavior, tasksassociated with operations in plan 2 that are not in plan 1 (e.g., inportion 1150) are postponed until the cancellation of tasks associatedwith operation in portion 1140 is completed. However, because operationsin each plan are configured to be able to be executed concurrently,tasks associated with operations in the intersection of plan 1 and plan2 represented by portion 1130 may be executed concurrently with thecancellation of tasks associated with operation in portion 1140 withouthaving to wait for their completion. By allowing for the concurrentcancellation of tasks associated with portion 1140 and the execution oftasks associated with portion 1130, more efficient use of availablecomputing resources may be achieved as well as a reduction in processingtime.

FIG. 12 shows an example method for managing changes in plans ofoperations, in accordance with various embodiments of the subjecttechnology. Although the methods and processes described herein may beshown with certain steps and operations in a particular order,additional, fewer, or alternative steps and operations performed insimilar or alternative orders, or in parallel, are within the scope ofvarious embodiments unless otherwise stated. The method 1200 may beimplemented by a system such as, for example, client synchronizationservice 156 of FIG. 2, running on a client device.

The system may be configured to receive updates from a contentmanagement system and/or the client device with regards to content itemsassociated with a content management service. For example the system mayreceive server modification data for content items stored by a contentmanagement service and update, based on the server modification data, aremote tree. The remote tree represents the server state for contentitems stored by the content management system. The system may alsoreceive client modification data for content items stored on the clientdevice and update, based on the client modification data, a local tree.The local tree represents the file system state for content items storedon the client device.

At operation 1205, the system may receive a first set of operationsconfigured to converge a server state associated with the contentmanagement system and a file system state associated with the clientdevice. For example, the system may identify differences between a synctree and a remote tree or the sync tree and a local tree and generatethe first set of operations based on any differences between the trees.The sync tree represents a known synced state between the server stateand the file system state.

The system may begin to implement the first set of operations. Forexample, in some cases, the operations are in a format ready to betransmitted to the content management system and/or the client devicefor execution. In other cases, the operations may be translated into oneor more tasks, scripts, or execution threads that may be managed by thesystem. The system may interface with the content management systemand/or the client device according to the tasks, scripts, or executionthreads in order to converge the server state and the file system state.

During this time, the system may continue to receive modification datafrom a content management system and/or the client device with regardsto content items associated with the content management service. Basedon the modification data, the system may update the remote tree or localtree and generate a second set of operations based on the updates to thetree data structures. At operation 1210, the system may receive thesecond set of operations.

At operation 1215, the system identifies a first operation in the firstset of operations that is not in the second set of operations, if any.If the system finds an operation in the first set of operations that isnot in the second set of operations, this operation may be stale and outof date as a result of changes specified in the modification data.Accordingly, the system will initiate the cancellation of the firstoperation at operation 1220. The cancellation of the first operation mayinclude a number of steps, a number of confirmation receipts for thesteps, and a non-trivial amount of processing time.

At operation 1225, the system identifies a second operation that isincluded in both the first set of operations and the second set ofoperations, if any. If the system finds an operation in both the firstset of operations and the second set of operations, this operation maybe still be valid notwithstanding changes specified in the modificationdata. Furthermore, since the operations in both sets of operations areconfigured to be able to be executed concurrently or in any order withrespect to other operations in the set, the second operation cancontinue execution while the first operation is canceled. Accordingly,the system will initiate the execution of the second operation atoperation 1230 without waiting for the first operation to completecancellation.

At operation 1235, the system identifies a third operation that is inthe second set of operations, but not in the first set of operations, ifany. If the system finds an operation in the second set of operationsthat is not in the first set of operations, this operation may be a newoperation as a result of changes specified in the modification data. Inorder to prevent unintended consequences, the system will initiate await for the completion of the cancellation of the first operation. Atoperation 1240, the system may determine that the first operation hascompleted cancellation and, as a result, initiate the execution of thethird operation at operation 1245.

Tree Data Structure Storage—Reduction of Filename Storage Space

Client Synchronization Service 156 may store the tree data structures(e.g., the remote tree, the sync tree, and the local tree) on apersistent storage device such as, for example, a hard disk, solid statememory, or other types of computer readable media. In order to improveperformance, reduce processing time, and reduce out-of-date operations,client synchronization service 156 may load the tree data structuresinto memory (e.g., random access memory or a cache of high-speed memory)on startup and perform synchronization functions on the tree datastructures in memory. Data capacity is limited on persistent storagedevices and conservation of these data resources is important. Datacapacity is even more limited and expensive for memory and conservationof these data resources is critical.

Depending on the operating system or client application, filenames forcontent items can be around 1024 bytes in size and may be the largestdata component in a node. For example, with a million nodes, the size ofjust the filenames for the nodes may reach upwards of 1 gigabyte. Asnoted above, client synchronization service 156 is configured to aid inthe synchronization of the server state and the file system state andthe local tree, the sync tree, and the remote tree reflect asynchronized state when all three trees are equivalent. Accordingly,there is likely some redundancy in storing the filenames of contentitems in the nodes.

Various embodiments of the subject technology aim to decrease the amountof memory needed to store filenames for the tree data structures andreduce the side of nodes by reducing the duplication of filenames.Instead of storing the filename in the node, client synchronizationservice 156 is configured to store filenames for nodes in the tree datastructures in a filename array and a reference to the filename in thenode. As a result, the filename is stored once in the filename array andany node with a content item having that filename may access thefilename using the reference stored in the node. In some implementationsthe reference to the filename stored in the node may be an integer valuethat represents the offset, location, or position of the filename in thefilename array.

FIG. 13 shows an illustration of a filename array 1310, in accordancewith various embodiments of the subject technology. Filename array 1310is shown storing filenames “Pictures,” “a.jpg,” and “Documents” (notshown entirely). The “Pictures” filename is shown at location 0, the“a.jpg” filename is shown at location 9, and the “Documents” filename isshown at location 16 in filename array 1310. In filename array 1310, aseparator 1314 (e.g., a null character) separates each filename.

Accordingly, to lookup the filename for a node, client synchronizationservice 156 may simply access the reference to the filename stored inthe node, which represents the location of the filename for the node infilename array 1310. Client synchronization service 156 may retrieve thefilename of the content item at the location in the filename array 1310specified by the reference. For example, client synchronization service156 may begin reading the filename at the location specified in thereference and stop when a separator 1314 is reached.

In some cases, client synchronization service 156 may also need tolookup reference based on a filename. For example, when adding a newnode or renaming a node client synchronization service 156 may wish todetermine whether the filename of the node already exists in filenamearray 1310. If the reference is found, the filename exists and may belocated based on the reference. Accordingly, client synchronizationservice 156 may use the reference to the filename and store thereference in the new or renamed node. If the reference is not found, thefilename does not exist in filename array 130 and client synchronizationservice 156 may add the filename to filename array 1310.

The lookup of the reference based on the filename is enabled by the useof a hash index array. FIG. 13 shows an illustration of a hash indexarray 1350, in accordance with various embodiments of the subjecttechnology. Hash index array 1350 is configured to store references tofilenames at various locations. In particular, the reference to afilename is stored at the position in hash index array 1350 based on thehash of the filename. In one example illustrated in FIG. 13, based on ahash function being used, the hash of filename “Pictures” may equal 4.Accordingly the reference to the filename “Pictures” is stored atposition 4 in hash index array 1350. This reference value is 0 which, asnoted above, specifies the location in the filename array 1310 of thefilename “Pictures.” Similarly, the hash of filename “Documents” mayequal 0. Accordingly the reference to the filename “Documents” is storedat position 0 in hash index array 1350. This reference value is 16which, as noted above, specifies the location in the filename array 1310of the filename “Documents.”

In some scenarios, a collision may occur where the hash of two filenamesyields the same hash value. In the example illustrated in FIG. 13, thehash value of “a.jpg” may also be 4. If a collision occurs, clientsynchronization service 156 may use the next available position in hashindex array 1350. For example, since the reference to the filename“Pictures” is stored at position 4 in hash index array 1350, clientsynchronization service 156 may look for the next available position inhash index array 1350 and store the reference (e.g., 9) to the filename“a.jpg”

FIG. 14 shows an example method for storing a filename, in accordancewith various embodiments of the subject technology. Although the methodsand processes described herein may be shown with certain steps andoperations in a particular order, additional, fewer, or alternativesteps and operations performed in similar or alternative orders, or inparallel, are within the scope of various embodiments unless otherwisestated. The method 1400 may be implemented by a system such as, forexample, client synchronization service 156 of FIG. 2, running on aclient device.

At operation 1405, the system may detect a modification to a node in atree data structure. The modification may be, for example, an add of thenode to the tree data structure or an edit of the filename of the node.The system may then determine whether or not the filename already existsin the filename array at operation 1410. The system may check to seewhether the filename is already in the filename array by querying, usingthe filename associated with the node, for a reference location of thefilename in the filename array. If a reference location is found, thereis no need to add the filename to the filename array and at operation1415, the system may determine the location for the filename in thefilename array, which should be the reference returned by the query, andstore the location of the filename in the node at operation 1420.

If the query does not return a reference for the filename in thefilename array or if the filename is not otherwise in the filenamearray, the system may append the filename and a separator to thefilename array at operation 1425, determine the location of the filenamein the filename array at operation 1430, and store the location of thefilename in the node at operation 1435.

In order enable the subsequent querying of the reference location basedon the filename, the system may further store the location of thefilename in a hash index. To determine which position in the hash indexto store the location of the filename, the system may compute a hashvalue of the file name. This hash value may be used to find the positionin the hash index to store the location of the filename.

Once the location of the filename is stored in a node, retrieving thefilename may simply involve accessing the location of the filename inthe node and using the location to lookup the filename in the filenamearray. The system may start from the location specified in the node andstop when a separator is reached.

FIG. 15 shows an example method for retrieving a location of a filenamegiven the filename, in accordance with various embodiments of thesubject technology. Although the methods and processes described hereinmay be shown with certain steps and operations in a particular order,additional, fewer, or alternative steps and operations performed insimilar or alternative orders, or in parallel, are within the scope ofvarious embodiments unless otherwise stated. The method 1500 may beimplemented by a system such as, for example, client synchronizationservice 156 of FIG. 2, running on a client device. As described above,the method may be used to determine whether a filename has already beenstored in the filename array.

The locations of the filenames are stored in a hash index or hash indexarray. Accordingly, at operation 1505, the system may generate aposition in the hash index by performing a hash function on thefilename. This may be, for example, the name of a new node or the newname for a node being renamed. At operation 1510, the system retrieves,from the position in the hash index, location information of thefilename. This location information is for a location in the filenamearray where the filename is stored.

In some implementations, the system may check to make sure the correctfilename is stored in the location at operation 1515. For example, thesystem may retrieve, based on the location information, a string fromthe filename array and compare the string with the filename. If thestring and the filename match, the location of the filename is confirmedand, at operation 1520, the location of the filename is stored in thenode.

If the string and the filename do not match, the retrieves the locationinformation in the next position in the hash index at operation 1530 andthe system may return to operation 1515 to check whether the locationinformation in the next position is accurate. The system may continueuntil the correct location information is found and, at operation 1520,stored in the node.

Efficiently Identifying Differences Between Trees

As noted above, client synchronization service 156 is configured toidentify differences between nodes in a remote tree representing aserver state for content items stored by the content management system,a local tree representing the file system state for the correspondingcontent items stored on the client device, and a sync tree representinga known synced state between the server state and the file system state.Based on these differences, a set of operations may be generated that,if executed, are configured to converge the server state and the filesystem state towards a synchronized state where the three tree datastructures would be identical.

When there are a large number of nodes, it is important to be able toidentify differences between the trees efficiently. For example, theremay be millions upon millions of nodes in a tree and comparing each nodeindividually can be prohibitive in terms of processing time and resourceusage.

Various embodiments of the subject technology relate to providing a moreefficient means to identify difference between trees. In particular,client synchronization service 156 is configured to assign values toeach node that can be used to compare with nodes in other trees todetermine whether the nodes are different. These values may be referredto as diff values. In order to improve the efficiency of identifyingdifferences between trees, each leaf node may be assigned a diff valueand diff values for parent nodes may be calculated based on the diffvalues of their child nodes. Diff values for every level of the treedata structure may be calculated in this way including the root node.

FIGS. 16A and 16B show examples of tree data structures, in accordancewith various embodiments. For illustrative purposes, FIGS. 16A and 16Bshow a sync tree and a local tree. However, the remote tree may performsimilarly. In FIGS. 16A and 16B, diff values for the leaf nodes for thesync tree and the local tree are computed using hash functions on thenodes. Each parent node (or node with children) has a diff valuecomputed based on the diff values of their child nodes.

For example, in sync tree 1605 of FIG. 16A, the diff value for node C is325, the diff value for node D is 742, and the diff value for B, theparent of nodes C and D, is calculated as a function of the diff valuesof C and D. In other words, the DiffValue(B)=f(DiffValue(C),DiffValue(D))=f(325, 742). Similarly, the diff value of the root node isa function of the diff values of its child nodes, node A and node B. Putanother way, DiffValue(/root)=f(DiffValue(A), DiffValue(B))=f(924, 789).

In order to identify differences between trees, client synchronizationservice 156 may compare diff values of corresponding nodes to seewhether they are different. If the diff values are the same, there is nodifference between trees. If the diff values are different, there is achange in the node or down a path associated with the node. As a result,client synchronization service 156 can look at the child nodes andcompare the corresponding nodes in the opposite tree to determinewhether they are different and whether there is a difference down a pathassociated with the child node.

For example, in FIG. 16A, client synchronization service 156 may comparediff values of the root node of sync tree 1605 and the root node oflocal tree 1610 and determine that the diff values match. Accordinglythere is no difference in the children of the root nodes. As a result,client synchronization service 156 may determine that sync tree 1605 andlocal tree 1610 match and are synchronized without needing to compareeach and every node in the trees with the corresponding node in theopposite tree.

In the example illustrated in FIG. 16B, client synchronization service156 may similarly compare diff values of the root node of sync tree 1605and the root node of local tree 1610. However, client synchronizationservice 156 may determine that the diff values of the root node of synctree 1605 and the root node of local tree 1610 are different, whichindicates that there may be a difference in the descendants of the rootnodes.

Accordingly, client synchronization service 156 may move to the nextlevel of the children of the root nodes to compare their diff values.For node A, the diff value of node A in sync tree 1615 and the diffvalue of node A in local tree 1620 match. Accordingly, there is nodifference between the two and the difference detected at the root levelis not caused by node A or any path down node A.

Moving to node B, client synchronization service 156 compare their diffvalues of node B in both trees and discover that the diff value of nodeA in sync tree 1615 and the diff value of node A in local tree 1620 aredifferent. Accordingly, the difference detected at the root level iscaused by node B or a path down node B. Client synchronization service156 may move to the next level of the children of node B to comparetheir diff values and discover that the difference detected at the rootlevel was caused by a deletion of node D. As a result, clientsynchronization service 156 may identify a difference between sync tree1615 and local tree 1620 without needing to compare each and every nodein the trees with the corresponding node in the opposite tree. Forexample node A may have had many descendant nodes that did not need tobe analyzed because the diff values of node A in both trees matched.

A Merkle tree or hash tree mechanism may work in some cases. Forexample, the diff value for each leaf node may be calculated based onthe hash of the leaf node and the diff value of non-leaf nodes may becomputed based on a hash of the sum of the child diff values. However,with the Merkle tree or hash tree mechanism has unfavorable performancemetrics in certain circumstances. When you add or delete a leaf node,the diff values of all of the ancestor nodes of the leaf node need tohave their diff values recomputed and recomputing each of the ancestornodes requires a listing of all of the children nodes for each ancestornode. This is computationally expensive, especially when the tree datastructures are stored in a way where each node is not stored in memorynext or near to a sibling node.

Various embodiments of the subject technology address these and othertechnical shortcomings by, among other things, computing the diff valuesof the parent nodes differently. The diff value of each leaf node may bedetermined by calculating a hash of the leaf node. The diff value ofeach parent node may be calculated by performing an exclusive-oroperation or XOR operation of the hashes of all of its children.

FIG. 17 shows an example of tree data structure, in accordance withvarious embodiments. In the tree data structure of FIG. 17, the diffvalues of leaf nodes A, C, and D are calculated by hashing the nodes.The diff value of node B is a XOR function of the hash of its childnodes, node C and node D. The diff value of the root node is a XORfunction of the hash of its child nodes, node A and node B. Importantqualities of the XOR function include that the XOR function is not ordersensitive, meaning that m XOR n would equal n XOR m. Also m XOR m equals0.

When you add or delete a leaf node, the diff values of all of theancestor nodes of the leaf node need to have their diff valuesrecomputed. However, computing the diff values of the ancestor nodes canbe done without requiring a listing of all. For example, when a childnode is deleted, the new diff value of the parent may be calculated byperforming an XOR operation on the old diff value of the parent and thediff value of the deleted child node. When a child node is added, thenew diff value of the parent may be calculated by performing an XORoperation on the old diff value of the parent and the diff value of thenew child node.

FIG. 18 shows an example method for retrieving a location of a filenamegiven the filename, in accordance with various embodiments of thesubject technology. Although the methods and processes described hereinmay be shown with certain steps and operations in a particular order,additional, fewer, or alternative steps and operations performed insimilar or alternative orders, or in parallel, are within the scope ofvarious embodiments unless otherwise stated. The method 1800 may beimplemented by a system such as, for example, client synchronizationservice 156 of FIG. 2, running on a client device. As described above,the method may be used to determine whether a filename has already beenstored in the filename array.

At operation 1805, client synchronization service 156 may add or removea node from a tree data structure such as the remote tree, the synctree, or the local tree. If the node is deleted, the node should have apreviously calculated diff value associated with it. If the node isadded, client synchronization service 156 may calculate a diff value forthe new node by, for example, hashing the node. Because there is achange to the tree, the diff values for the ancestors of the node mustbe updated.

At operations 1810, client synchronization service 156 may calculate anew diff value for the parent of the node based on the current diffvalue of the parent node and the diff value of the node. At operation1815, the new diff value for the parent is stored in the parent node.

At operation 1820, client synchronization service 156 determines whetherthe parent node itself has a parent. In other words, where the parentnode a root node or whether there additional ancestors to compute diffvalues for. If there is an additional parent, the process may return tooperation 1810 where the parent of the parent node will have a new diffvalue calculated and stored. If there is not an additional parent andthe parent node is a root node, the process may stop at operation 1825.

Once the root node is reached the tree data structure is ready to becompared with other tree data structures in order to identifydifferences. As noted above, client synchronization service 156 maygenerate a set of operations based on these differences that ifexecuted, are configured to converge the server state and the filesystem state towards a synchronized state where the three tree datastructures would be identical.

FIG. 19 shows an example of computing system 1900, which can be forexample any computing device making up client device 150, contentmanagement system 110 or any component thereof in which the componentsof the system are in communication with each other using connection1905. Connection 1905 can be a physical connection via a bus, or adirect connection into processor 1910, such as in a chipsetarchitecture. Connection 1905 can also be a virtual connection,networked connection, or logical connection.

In some embodiments computing system 1900 is a distributed system inwhich the functions described in this disclosure can be distributedwithin a datacenter, multiple datacenters, a peer network, etc. In someembodiments, one or more of the described system components representsmany such components each performing some or all of the function forwhich the component is described. In some embodiments, the componentscan be physical or virtual devices.

Example system 1900 includes at least one processing unit (CPU orprocessor) 1910 and connection 1905 that couples various systemcomponents including system memory 1915, such as read only memory (ROM)1920 and random access memory (RAM) 1925 to processor 1910. Computingsystem 1900 can include a cache of high-speed memory 1912 connecteddirectly with, in close proximity to, or integrated as part of processor1910.

Processor 1910 can include any general purpose processor and a hardwareservice or software service, such as services 1932, 1934, and 1936stored in storage device 1930, configured to control processor 1910 aswell as a special-purpose processor where software instructions areincorporated into the actual processor design. Processor 1910 mayessentially be a completely self-contained computing system, containingmultiple cores or processors, a bus, memory controller, cache, etc. Amulti-core processor may be symmetric or asymmetric.

To enable user interaction, computing system 1900 includes an inputdevice 1945, which can represent any number of input mechanisms, such asa microphone for speech, a touch-sensitive screen for gesture orgraphical input, keyboard, mouse, motion input, speech, etc. Computingsystem 1900 can also include output device 1935, which can be one ormore of a number of output mechanisms known to those of skill in theart. In some instances, multimodal systems can enable a user to providemultiple types of input/output to communicate with computing system1900. Computing system 1900 can include communications interface 1940,which can generally govern and manage the user input and system output.There is no restriction on operating on any particular hardwarearrangement and therefore the basic features here may easily besubstituted for improved hardware or firmware arrangements as they aredeveloped.

Storage device 1930 can be a non-volatile memory device and can be ahard disk or other types of computer readable media which can store datathat are accessible by a computer, such as magnetic cassettes, flashmemory cards, solid state memory devices, digital versatile disks,cartridges, random access memories (RAMs), read only memory (ROM),and/or some combination of these devices.

The storage device 1930 can include software services, servers,services, etc., that when the code that defines such software isexecuted by the processor 1910, it causes the system to perform afunction. In some embodiments, a hardware service that performs aparticular function can include the software component stored in acomputer-readable medium in connection with the necessary hardwarecomponents, such as processor 1910, connection 1905, output device 1935,etc., to carry out the function.

For clarity of explanation, in some instances the present technology maybe presented as including individual functional blocks includingfunctional blocks comprising devices, device components, steps orroutines in a method embodied in software, or combinations of hardwareand software.

Any of the steps, operations, functions, or processes described hereinmay be performed or implemented by a combination of hardware andsoftware services or services, alone or in combination with otherdevices. In some embodiments, a service can be software that resides inmemory of a client device and/or one or more servers of a contentmanagement system and perform one or more functions when a processorexecutes the software associated with the service. In some embodiments,a service is a program, or a collection of programs that carry out aspecific function. In some embodiments, a service can be considered aserver. The memory can be a non-transitory computer-readable medium.

In some embodiments the computer-readable storage devices, mediums, andmemories can include a cable or wireless signal containing a bit streamand the like. However, when mentioned, non-transitory computer-readablestorage media expressly exclude media such as energy, carrier signals,electromagnetic waves, and signals per se.

Methods according to the above-described examples can be implementedusing computer-executable instructions that are stored or otherwiseavailable from computer readable media. Such instructions can comprise,for example, instructions and data which cause or otherwise configure ageneral purpose computer, special purpose computer, or special purposeprocessing device to perform a certain function or group of functions.Portions of computer resources used can be accessible over a network.The computer executable instructions may be, for example, binaries,intermediate format instructions such as assembly language, firmware, orsource code. Examples of computer-readable media that may be used tostore instructions, information used, and/or information created duringmethods according to described examples include magnetic or opticaldisks, solid state memory devices, flash memory, USB devices providedwith non-volatile memory, networked storage devices, and so on.

Devices implementing methods according to these disclosures can comprisehardware, firmware and/or software, and can take any of a variety ofform factors. Typical examples of such form factors include servers,laptops, smart phones, small form factor personal computers, personaldigital assistants, and so on. Functionality described herein also canbe embodied in peripherals or add-in cards. Such functionality can alsobe implemented on a circuit board among different chips or differentprocesses executing in a single device, by way of further example.

The instructions, media for conveying such instructions, computingresources for executing them, and other structures for supporting suchcomputing resources are means for providing the functions described inthese disclosures.

Although a variety of examples and other information was used to explainaspects within the scope of the appended claims, no limitation of theclaims should be implied based on particular features or arrangements insuch examples, as one of ordinary skill would be able to use theseexamples to derive a wide variety of implementations. Further andalthough some subject matter may have been described in languagespecific to examples of structural features and/or method steps, it isto be understood that the subject matter defined in the appended claimsis not necessarily limited to these described features or acts. Forexample, such functionality can be distributed differently or performedin components other than those identified herein. Rather, the describedfeatures and steps are disclosed as examples of components of systemsand methods within the scope of the appended claims.

1. A computer-implemented method for synchronizing modifications to auser account on a content management system to a client deviceauthorized to access the user account, the method comprising: computinga difference between a remote tree data structure representing a serverstate for content items associated with the user account on the contentmanagement system and a sync tree data structure representing a knownsynchronization state between the content management system and theclient device; and generating, based on the difference, a set ofoperations that when performed on the client device update the contentitems stored on the client device to converge a file system state on theclient device and the server state.
 2. The computer-implemented methodof claim 1, further comprising executing the set of operations.
 3. Thecomputer-implemented method of claim 1, wherein the remote tree datastructure and the sync tree data structure are stored on the clientdevice.
 4. The computer-implemented method of claim 1, furthercomprising: receiving, from the client device, client modification datafor content items stored on the client device; and updating, based onthe client modification data, the local tree.
 5. Thecomputer-implemented method of claim 4, further comprising updating,based on the client modification data, the sync tree.
 6. Thecomputer-implemented method of claim 1, further comprising: computing asecond difference between a local tree data structure representing afile system state for content items associated with the user account onthe client device and the sync tree data structure representing a knownsynchronization state between the content management system and theclient device; generating, based on the difference, a second set ofoperations that when performed update the content items stored on thecontent management system to converge a server state for content itemsassociated the user account on the content management system and thefile system state; and managing execution of the second set ofoperations.
 7. The computer-implemented method of claim 6, wherein thelocal tree data structure is stored on the client device.
 8. Thecomputer-implemented method of claim 6, further comprising: receiving,from the content management system, server modification data for contentitems stored by the content management system; and updating, based onthe server modification data, the remote tree.
 9. Thecomputer-implemented method of claim 8, further comprising updating,based on the server modification data, the sync tree.
 10. Anon-transitory computer readable medium comprising instructions, theinstructions, when executed by a computing system, cause the computingsystem to: compute a difference between a remote tree data structurerepresenting a server state for content items associated with an accounton a content management system and a sync tree data structurerepresenting a known synchronization state between the contentmanagement system and the computing system; and generate, based on thedifference, a set of operations that when performed on the computingsystem update the content items stored on the client device to convergea file system state on the computing system and the server state. 11.The non-transitory computer readable medium of claim 10, whereininstructions further cause the computing system to execute the set ofoperations.
 12. The non-transitory computer readable medium of claim 10,wherein the remote tree data structure and the sync tree data structureare stored on the computing system.
 13. The non-transitory computerreadable medium of claim 10, wherein instructions further cause thecomputing system to: receive, from the computing system, clientmodification data for content items stored on the computing system; andupdate, based on the client modification data, the local tree.
 14. Thenon-transitory computer readable medium of claim 13, whereininstructions further cause the computing system to update, based on theclient modification data, the sync tree.
 15. A system comprising: aprocessor; and a non-transitory computer-readable medium storinginstructions that, when executed by the processor, cause the processorto: compute a difference between a remote tree data structurerepresenting a server state for content items associated with a useraccount on a content management system and a sync tree data structurerepresenting a known synchronization state between the contentmanagement system and the system; and generate, based on the difference,a set of operations that when performed on the system, update thecontent items stored on the client device to converge a file systemstate on the system and the server state.
 16. The system of claim 15,wherein instructions further cause the processor to execute the set ofoperations.
 17. The system of claim 15, wherein the remote tree datastructure and the sync tree data structure are stored on the system. 18.The system of claim 15, wherein instructions further cause the processorto: receive, from the system, client modification data for content itemsstored by the system; and update, based on the client modification data,the local tree.
 19. The system of claim 18, wherein instructions furthercause the processor to update, based on the client modification data,the sync tree.
 20. The system of claim 15, wherein instructions furthercause the processor to: compute a second difference between a local treedata structure representing a file system state for content itemsassociated with the user account on the system and the sync tree datastructure representing a known synchronization state between the contentmanagement system and the system; generate, based on the difference, asecond set of operations that when performed update the content itemsstored on the content management system to converge a server state forcontent items associated the user account on the content managementsystem and the file system state; and managing execution of the secondset of operations.